|
1 | | -package org.jvnet.jaxb2_commons.xml.bind.model.concrete; |
2 | | - |
3 | | -import java.util.ArrayList; |
4 | | -import java.util.Collection; |
5 | | -import java.util.Collections; |
6 | | -import java.util.List; |
7 | | - |
8 | | -import javax.xml.namespace.QName; |
9 | | - |
10 | | -import org.jvnet.jaxb2_commons.lang.Validate; |
11 | | -import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; |
12 | | -import org.jvnet.jaxb2_commons.xml.bind.model.MElement; |
13 | | -import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; |
14 | | -import org.jvnet.jaxb2_commons.xml.bind.model.MElementTypeInfo; |
15 | | -import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; |
16 | | -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MElementOrigin; |
17 | | -import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; |
18 | | - |
19 | | -public class CMElementRefsPropertyInfo<T, C extends T> extends |
20 | | - CMPropertyInfo<T, C> implements MElementRefsPropertyInfo<T, C> { |
21 | | - |
22 | | - private final QName wrapperElementName; |
23 | | - |
24 | | - private final List<MElement<T, C>> elementTypeInfos = new ArrayList<MElement<T, C>>(); |
25 | | - private final List<MElement<T, C>> unmodifiableElementTypeInfos = Collections |
26 | | - .unmodifiableList(elementTypeInfos); |
27 | | - |
28 | | - private final boolean mixed; |
29 | | - private final boolean domAllowed; |
30 | | - private final boolean typedObjectAllowed; |
31 | | - |
32 | | - public CMElementRefsPropertyInfo( |
33 | | - MPropertyInfoOrigin origin, |
34 | | - MClassInfo<T, C> classInfo, |
35 | | - String privateName, |
36 | | - boolean collection, |
37 | | - boolean required, |
38 | | - Collection<MElement<T, C>> elementTypeInfos, |
39 | | - QName wrapperElementName, boolean mixed, boolean domAllowed, |
40 | | - boolean typedObjectAllowed) { |
41 | | - super(origin, classInfo, privateName, collection, required); |
42 | | - Validate.noNullElements(elementTypeInfos); |
43 | | - // Validate.notEmpty(elementTypeInfos); |
44 | | - // Validate.isTrue(elementTypeInfos.size() > 1); |
45 | | - this.elementTypeInfos.addAll(elementTypeInfos); |
46 | | - this.wrapperElementName = wrapperElementName; |
47 | | - this.mixed = mixed; |
48 | | - this.domAllowed = domAllowed; |
49 | | - this.typedObjectAllowed = typedObjectAllowed; |
50 | | - } |
51 | | - |
52 | | - public List<MElement<T, C>> getElementTypeInfos() { |
53 | | - return unmodifiableElementTypeInfos; |
54 | | - } |
55 | | - |
56 | | - public QName getWrapperElementName() { |
57 | | - return wrapperElementName; |
58 | | - } |
59 | | - |
60 | | - public boolean isMixed() { |
61 | | - return mixed; |
62 | | - } |
63 | | - |
64 | | - public boolean isDomAllowed() { |
65 | | - return domAllowed; |
66 | | - } |
67 | | - |
68 | | - public boolean isTypedObjectAllowed() { |
69 | | - return typedObjectAllowed; |
70 | | - } |
71 | | - |
72 | | - public <V> V acceptPropertyInfoVisitor(MPropertyInfoVisitor<T, C, V> visitor) { |
73 | | - return visitor.visitElementRefsPropertyInfo(this); |
74 | | - } |
75 | | - |
76 | | -} |
| 1 | +package org.jvnet.jaxb2_commons.xml.bind.model.concrete; |
| 2 | + |
| 3 | +import java.util.ArrayList; |
| 4 | +import java.util.Collection; |
| 5 | +import java.util.Collections; |
| 6 | +import java.util.List; |
| 7 | + |
| 8 | +import javax.xml.namespace.QName; |
| 9 | + |
| 10 | +import org.jvnet.jaxb2_commons.lang.Validate; |
| 11 | +import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; |
| 12 | +import org.jvnet.jaxb2_commons.xml.bind.model.MElement; |
| 13 | +import org.jvnet.jaxb2_commons.xml.bind.model.MElementRefsPropertyInfo; |
| 14 | +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfoVisitor; |
| 15 | +import org.jvnet.jaxb2_commons.xml.bind.model.origin.MPropertyInfoOrigin; |
| 16 | + |
| 17 | +public class CMElementRefsPropertyInfo<T, C extends T> extends |
| 18 | + CMPropertyInfo<T, C> implements MElementRefsPropertyInfo<T, C> { |
| 19 | + |
| 20 | + private final QName wrapperElementName; |
| 21 | + |
| 22 | + private final List<MElement<T, C>> elementTypeInfos = new ArrayList<MElement<T, C>>(); |
| 23 | + private final List<MElement<T, C>> unmodifiableElementTypeInfos = Collections |
| 24 | + .unmodifiableList(elementTypeInfos); |
| 25 | + |
| 26 | + private final boolean mixed; |
| 27 | + private final boolean domAllowed; |
| 28 | + private final boolean typedObjectAllowed; |
| 29 | + |
| 30 | + public CMElementRefsPropertyInfo( |
| 31 | + MPropertyInfoOrigin origin, |
| 32 | + MClassInfo<T, C> classInfo, |
| 33 | + String privateName, |
| 34 | + boolean collection, |
| 35 | + boolean required, |
| 36 | + Collection<MElement<T, C>> elementTypeInfos, |
| 37 | + QName wrapperElementName, boolean mixed, boolean domAllowed, |
| 38 | + boolean typedObjectAllowed) { |
| 39 | + super(origin, classInfo, privateName, collection, required); |
| 40 | + Validate.noNullElements(elementTypeInfos); |
| 41 | + // Validate.notEmpty(elementTypeInfos); |
| 42 | + // Validate.isTrue(elementTypeInfos.size() > 1); |
| 43 | + this.elementTypeInfos.addAll(elementTypeInfos); |
| 44 | + this.wrapperElementName = wrapperElementName; |
| 45 | + this.mixed = mixed; |
| 46 | + this.domAllowed = domAllowed; |
| 47 | + this.typedObjectAllowed = typedObjectAllowed; |
| 48 | + } |
| 49 | + |
| 50 | + public List<MElement<T, C>> getElementTypeInfos() { |
| 51 | + return unmodifiableElementTypeInfos; |
| 52 | + } |
| 53 | + |
| 54 | + public QName getWrapperElementName() { |
| 55 | + return wrapperElementName; |
| 56 | + } |
| 57 | + |
| 58 | + public boolean isMixed() { |
| 59 | + return mixed; |
| 60 | + } |
| 61 | + |
| 62 | + public boolean isDomAllowed() { |
| 63 | + return domAllowed; |
| 64 | + } |
| 65 | + |
| 66 | + public boolean isTypedObjectAllowed() { |
| 67 | + return typedObjectAllowed; |
| 68 | + } |
| 69 | + |
| 70 | + public <V> V acceptPropertyInfoVisitor(MPropertyInfoVisitor<T, C, V> visitor) { |
| 71 | + return visitor.visitElementRefsPropertyInfo(this); |
| 72 | + } |
| 73 | + |
| 74 | +} |
0 commit comments