1 package xdoclet.sdk.xgg;
2
3 import java.util.ArrayList;
4 import java.util.Iterator;
5 import java.util.List;
6
7 import xdoclet.sdk.xgg.binding.SubElement;
8
9 /***
10 * This class is a data object for Velocity used during generation of beans
11 * that represent XML elements.
12 *
13 * @author <a href="mailto:aslak.hellesoy at bekk.no">Aslak Hellesøy</a>
14 * @created 7 mai 2003
15 * @version $Revision: 1.3 $
16 */
17 public final class Referer {
18 private final List _subElements = new ArrayList();
19
20
21 /***
22 * Adds a sub element to this referer
23 *
24 * @param element The sub element to add
25 */
26 public void addSubElement(SubElement element) {
27 _subElements.add(element);
28 }
29
30
31 /***
32 * Gets the Java name of the referer
33 *
34 * @return The Java name
35 */
36 public String getJavaName() {
37 SubElement subElement0 = (SubElement) _subElements.get(0);
38 return subElement0.getContainer().getJavaName();
39 }
40
41
42 /***
43 * Returns the list of all sub elements of this referer
44 *
45 * @return The list of sub elements
46 */
47 public List getSubElements() {
48 return _subElements;
49 }
50
51
52 /***
53 * Returns whether or not this referer has a many cardinality.
54 * If one of the sub element has a many cardinality, then this
55 * referer has a many cardinality.
56 *
57 * @return True if it has a many cardinality
58 */
59 public boolean isMany() {
60 boolean result = false;
61 for (Iterator i = _subElements.iterator(); i.hasNext(); ) {
62 SubElement subElement = (SubElement) i.next();
63 if (subElement.isMany()) {
64 result = true;
65 break;
66 }
67 }
68 return result;
69 }
70 }
This page was automatically generated by Maven