1 package xdoclet.sdk.xgg.binding;
2
3
4 /***
5 * Holder object for a XML attribute
6 *
7 * @author <a href="mailto:aslak.hellesoy at bekk.no">Aslak Hellesøy</a>
8 * @author <a href="mailto:letiemble at users.sourceforge.net">Laurent Etiemble</a>
9 * @created 6 mai 2003
10 * @version $Revision: 1.7 $
11 */
12 public class Attribute extends Binding implements Child {
13 private Cardinality _card = new Cardinality(Cardinality.ONE, Cardinality.ONE);
14 private final Element _container;
15
16
17 /***
18 * Constructor for an Attribute object
19 *
20 * @param xmlName XML name of the attribute
21 * @param container Element whose has this attribute
22 */
23 public Attribute(String xmlName, Element container) {
24 super(xmlName, container.getVersion());
25 _container = container;
26 }
27
28
29 /***
30 * Gets the cardinality related to the associated attribute
31 *
32 * @return The cardinality holder
33 */
34 public Cardinality getCardinality() {
35 return _card;
36 }
37
38
39 /***
40 * Gets the container element
41 *
42 * @return The container element
43 */
44 public Element getContainer() {
45 return _container;
46 }
47
48
49 /***
50 * Gets the Java name of the child
51 *
52 * @return The Java name
53 */
54 public String getJavaName() {
55 return super.getJavaName() + "_Att";
56 }
57
58
59 /***
60 * Gets the Java type of the child
61 *
62 * @return The Java type
63 */
64 public String getJavaType() {
65 return "java.lang.String";
66 }
67
68
69 /***
70 * Returns whether or not this sub element is an attribute
71 *
72 * @return True if it is an attribute
73 */
74 public boolean isAttribute() {
75 return true;
76 }
77
78
79 /***
80 * Returns whether or not this sub element has a many cardinality
81 *
82 * @return True if it has a many cardinality
83 */
84 public boolean isMany() {
85 return false;
86 }
87
88 public String getId() {
89 return getClass().getName() + "_" + getXmlName();
90 }
91
92 public boolean equals( Object o ) {
93 Child other = (Child) o;
94 return getId().equals( other.getId() );
95 }
96
97 /***
98 * Implementation of the toString method
99 *
100 * @return String representation
101 */
102 public String toString() {
103 return "ATTRIBUTE: " + getXmlName() + " " + _card.toString();
104 }
105 }
This page was automatically generated by Maven