-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e90b9cf
commit 3343dd5
Showing
2 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
compiler/src/main/java/org/hisrc/jsonix/xml/bind/model/FooBar.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.hisrc.jsonix.xml.bind.model; | ||
|
||
import com.sun.xml.xsom.XmlString; | ||
|
||
public abstract class FooBar<I> { | ||
|
||
public abstract I parse(XmlString value); | ||
|
||
|
||
|
||
} |
135 changes: 135 additions & 0 deletions
135
compiler/src/main/java/org/hisrc/jsonix/xml/xsom/CollectEnumerationValuesVisitor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
package org.hisrc.jsonix.xml.xsom; | ||
|
||
import java.util.LinkedList; | ||
import java.util.List; | ||
|
||
import com.sun.xml.xsom.XSAnnotation; | ||
import com.sun.xml.xsom.XSAttGroupDecl; | ||
import com.sun.xml.xsom.XSAttributeDecl; | ||
import com.sun.xml.xsom.XSAttributeUse; | ||
import com.sun.xml.xsom.XSComplexType; | ||
import com.sun.xml.xsom.XSContentType; | ||
import com.sun.xml.xsom.XSElementDecl; | ||
import com.sun.xml.xsom.XSFacet; | ||
import com.sun.xml.xsom.XSIdentityConstraint; | ||
import com.sun.xml.xsom.XSListSimpleType; | ||
import com.sun.xml.xsom.XSModelGroup; | ||
import com.sun.xml.xsom.XSModelGroupDecl; | ||
import com.sun.xml.xsom.XSNotation; | ||
import com.sun.xml.xsom.XSParticle; | ||
import com.sun.xml.xsom.XSRestrictionSimpleType; | ||
import com.sun.xml.xsom.XSSchema; | ||
import com.sun.xml.xsom.XSSimpleType; | ||
import com.sun.xml.xsom.XSUnionSimpleType; | ||
import com.sun.xml.xsom.XSWildcard; | ||
import com.sun.xml.xsom.XSXPath; | ||
import com.sun.xml.xsom.XmlString; | ||
import com.sun.xml.xsom.visitor.XSSimpleTypeVisitor; | ||
import com.sun.xml.xsom.visitor.XSVisitor; | ||
|
||
public class CollectEnumerationValuesVisitor implements XSVisitor, XSSimpleTypeVisitor { | ||
|
||
// protected Log logger = LogFactory.getLog(getClass()); | ||
|
||
private List<XmlString> values = new LinkedList<XmlString>(); | ||
|
||
public List<XmlString> getValues() { | ||
return values; | ||
} | ||
|
||
public void annotation(XSAnnotation ann) { | ||
// todo("Annotation."); | ||
} | ||
|
||
public void attGroupDecl(XSAttGroupDecl decl) { | ||
// todo("Attribute group declaration [" + decl.getName() + "]."); | ||
} | ||
|
||
public void attributeDecl(XSAttributeDecl decl) { | ||
decl.getType().visit((XSSimpleTypeVisitor) this); | ||
} | ||
|
||
public void attributeUse(XSAttributeUse use) { | ||
use.getDecl().visit(this); | ||
} | ||
|
||
public void complexType(XSComplexType type) { | ||
// todo("Complex type [" + type.getName() + "]."); | ||
} | ||
|
||
public void facet(XSFacet facet) { | ||
// todo("Facet."); | ||
} | ||
|
||
public void identityConstraint(XSIdentityConstraint decl) { | ||
// todo("Identity constraint."); | ||
} | ||
|
||
public void notation(XSNotation notation) { | ||
// todo("Notation."); | ||
} | ||
|
||
public void schema(XSSchema schema) { | ||
// todo("Schema."); | ||
} | ||
|
||
public void xpath(XSXPath xp) { | ||
// todo("XPath."); | ||
} | ||
|
||
public void elementDecl(XSElementDecl decl) { | ||
decl.getType().visit(this); | ||
} | ||
|
||
public void modelGroup(XSModelGroup group) { | ||
for (XSParticle child : group.getChildren()) { | ||
child.visit(this); | ||
} | ||
} | ||
|
||
public void modelGroupDecl(XSModelGroupDecl decl) { | ||
// todo("Model group declaration."); | ||
} | ||
|
||
public void wildcard(XSWildcard wc) { | ||
// todo("Wildcard."); | ||
} | ||
|
||
public void empty(XSContentType empty) { | ||
// todo("Empty."); | ||
} | ||
|
||
public void particle(XSParticle particle) { | ||
particle.getTerm().visit(this); | ||
} | ||
|
||
public void simpleType(XSSimpleType simpleType) { | ||
simpleType.visit((XSSimpleTypeVisitor) this); | ||
} | ||
|
||
@Override | ||
public void listSimpleType(XSListSimpleType type) { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public void unionSimpleType(XSUnionSimpleType type) { | ||
// for (XSSimpleType memberSimpleType : type) { | ||
// memberSimpleType.visit((XSSimpleTypeVisitor) this); | ||
// } | ||
} | ||
|
||
@Override | ||
public void restrictionSimpleType(XSRestrictionSimpleType type) { | ||
final List<XSFacet> facets = type.getFacets(XSFacet.FACET_ENUMERATION); | ||
if (facets != null) { | ||
for (XSFacet facet : facets) { | ||
final XmlString value = facet.getValue(); | ||
if (value != null) { | ||
this.values.add(value); | ||
} | ||
} | ||
} | ||
} | ||
} |