Skip to content

Commit 3343dd5

Browse files
committed
Issue #67 missing commits.
1 parent e90b9cf commit 3343dd5

File tree

2 files changed

+146
-0
lines changed

2 files changed

+146
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package org.hisrc.jsonix.xml.bind.model;
2+
3+
import com.sun.xml.xsom.XmlString;
4+
5+
public abstract class FooBar<I> {
6+
7+
public abstract I parse(XmlString value);
8+
9+
10+
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
package org.hisrc.jsonix.xml.xsom;
2+
3+
import java.util.LinkedList;
4+
import java.util.List;
5+
6+
import com.sun.xml.xsom.XSAnnotation;
7+
import com.sun.xml.xsom.XSAttGroupDecl;
8+
import com.sun.xml.xsom.XSAttributeDecl;
9+
import com.sun.xml.xsom.XSAttributeUse;
10+
import com.sun.xml.xsom.XSComplexType;
11+
import com.sun.xml.xsom.XSContentType;
12+
import com.sun.xml.xsom.XSElementDecl;
13+
import com.sun.xml.xsom.XSFacet;
14+
import com.sun.xml.xsom.XSIdentityConstraint;
15+
import com.sun.xml.xsom.XSListSimpleType;
16+
import com.sun.xml.xsom.XSModelGroup;
17+
import com.sun.xml.xsom.XSModelGroupDecl;
18+
import com.sun.xml.xsom.XSNotation;
19+
import com.sun.xml.xsom.XSParticle;
20+
import com.sun.xml.xsom.XSRestrictionSimpleType;
21+
import com.sun.xml.xsom.XSSchema;
22+
import com.sun.xml.xsom.XSSimpleType;
23+
import com.sun.xml.xsom.XSUnionSimpleType;
24+
import com.sun.xml.xsom.XSWildcard;
25+
import com.sun.xml.xsom.XSXPath;
26+
import com.sun.xml.xsom.XmlString;
27+
import com.sun.xml.xsom.visitor.XSSimpleTypeVisitor;
28+
import com.sun.xml.xsom.visitor.XSVisitor;
29+
30+
public class CollectEnumerationValuesVisitor implements XSVisitor, XSSimpleTypeVisitor {
31+
32+
// protected Log logger = LogFactory.getLog(getClass());
33+
34+
private List<XmlString> values = new LinkedList<XmlString>();
35+
36+
public List<XmlString> getValues() {
37+
return values;
38+
}
39+
40+
public void annotation(XSAnnotation ann) {
41+
// todo("Annotation.");
42+
}
43+
44+
public void attGroupDecl(XSAttGroupDecl decl) {
45+
// todo("Attribute group declaration [" + decl.getName() + "].");
46+
}
47+
48+
public void attributeDecl(XSAttributeDecl decl) {
49+
decl.getType().visit((XSSimpleTypeVisitor) this);
50+
}
51+
52+
public void attributeUse(XSAttributeUse use) {
53+
use.getDecl().visit(this);
54+
}
55+
56+
public void complexType(XSComplexType type) {
57+
// todo("Complex type [" + type.getName() + "].");
58+
}
59+
60+
public void facet(XSFacet facet) {
61+
// todo("Facet.");
62+
}
63+
64+
public void identityConstraint(XSIdentityConstraint decl) {
65+
// todo("Identity constraint.");
66+
}
67+
68+
public void notation(XSNotation notation) {
69+
// todo("Notation.");
70+
}
71+
72+
public void schema(XSSchema schema) {
73+
// todo("Schema.");
74+
}
75+
76+
public void xpath(XSXPath xp) {
77+
// todo("XPath.");
78+
}
79+
80+
public void elementDecl(XSElementDecl decl) {
81+
decl.getType().visit(this);
82+
}
83+
84+
public void modelGroup(XSModelGroup group) {
85+
for (XSParticle child : group.getChildren()) {
86+
child.visit(this);
87+
}
88+
}
89+
90+
public void modelGroupDecl(XSModelGroupDecl decl) {
91+
// todo("Model group declaration.");
92+
}
93+
94+
public void wildcard(XSWildcard wc) {
95+
// todo("Wildcard.");
96+
}
97+
98+
public void empty(XSContentType empty) {
99+
// todo("Empty.");
100+
}
101+
102+
public void particle(XSParticle particle) {
103+
particle.getTerm().visit(this);
104+
}
105+
106+
public void simpleType(XSSimpleType simpleType) {
107+
simpleType.visit((XSSimpleTypeVisitor) this);
108+
}
109+
110+
@Override
111+
public void listSimpleType(XSListSimpleType type) {
112+
// TODO Auto-generated method stub
113+
114+
}
115+
116+
@Override
117+
public void unionSimpleType(XSUnionSimpleType type) {
118+
// for (XSSimpleType memberSimpleType : type) {
119+
// memberSimpleType.visit((XSSimpleTypeVisitor) this);
120+
// }
121+
}
122+
123+
@Override
124+
public void restrictionSimpleType(XSRestrictionSimpleType type) {
125+
final List<XSFacet> facets = type.getFacets(XSFacet.FACET_ENUMERATION);
126+
if (facets != null) {
127+
for (XSFacet facet : facets) {
128+
final XmlString value = facet.getValue();
129+
if (value != null) {
130+
this.values.add(value);
131+
}
132+
}
133+
}
134+
}
135+
}

0 commit comments

Comments
 (0)