View Javadoc
1 package xdoclet.sdk.xgg.binding; 2 3 4 /*** 5 * Represents a sub element in an element declaration. 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.4 $ 11 */ 12 public class SubElement implements Child { 13 private Cardinality _card = new Cardinality(Cardinality.ONE, Cardinality.ONE); 14 private final Element _container; 15 private final Element _element; 16 17 18 /*** 19 * Constructor for the SubElement object 20 * 21 * @param element Description of the Parameter 22 * @param container Description of the Parameter 23 */ 24 public SubElement(Element element, Element container) { 25 _element = element; 26 _container = container; 27 _element.addReferer(this); 28 } 29 30 31 /*** 32 * Gets the cardinality related to the associated element 33 * 34 * @return The cardinality holder 35 */ 36 public Cardinality getCardinality() { 37 return _card; 38 } 39 40 41 /*** 42 * Gets the container element 43 * 44 * @return The container element 45 */ 46 public Element getContainer() { 47 return _container; 48 } 49 50 51 /*** 52 * Gets the associated element 53 * 54 * @return The associated element 55 */ 56 public Element getElement() { 57 return _element; 58 } 59 60 61 /*** 62 * Gets the Java name of associated element 63 * 64 * @return The Java name 65 */ 66 public String getJavaName() { 67 return getElement().getJavaName(); 68 } 69 70 71 /*** 72 * Gets the Java type of the associated element 73 * 74 * @return The Java type 75 */ 76 public String getJavaType() { 77 return getElement().getJavaType(); 78 } 79 80 81 /*** 82 * Gets the version 83 * 84 * @return The version 85 */ 86 public String getVersion() { 87 return getElement().getVersion(); 88 } 89 90 91 /*** 92 * Gets the XML name of the associated element 93 * 94 * @return The XML name 95 */ 96 public String getXmlName() { 97 return getElement().getXmlName(); 98 } 99 100 101 /*** 102 * Returns whether or not this sub element is an attribute 103 * 104 * @return True if it is an attribute 105 */ 106 public boolean isAttribute() { 107 return false; 108 } 109 110 111 /*** 112 * Returns whether or not this sub element has a many cardinality 113 * 114 * @return True if it has a many cardinality 115 */ 116 public boolean isMany() { 117 return _card.isMany(); 118 } 119 120 public String getId() { 121 return getClass().getName() + "_" + getXmlName(); 122 } 123 124 public boolean equals( Object o ) { 125 Child other = (Child) o; 126 return getId().equals( other.getId() ); 127 } 128 129 /*** 130 * Implementation of the toString method 131 * 132 * @return String representation 133 */ 134 public String toString() { 135 return "SUB ELEMENT: " + getXmlName() + " " + _card.toString(); 136 } 137 }

This page was automatically generated by Maven