A client must invoke methods in the following order:
XmlSchemaGenerator
add methods, multiple times if necessary.
write
XmlSchemaGenerator.
| Modifier and Type | Class and Description |
|---|---|
| private class | XmlSchemaGenerator.
Schema components are organized per namespace. |
| Modifier and Type | Field and Description |
|---|---|
| private final NonElement | anyType
Represents xs:anyType. |
| private final CollisionCheckStack | collisionChecker
Used to detect cycles in types. |
| private ErrorListener | errorListener
|
| private static final Logger | |
| private static final Comparator | NAMESPACE_COMPARATOR
JAX-RPC wants the namespaces to be sorted in the reverse order so that the empty namespace "" comes to the very end. |
| private final Map | namespaces
Java classes to be written, organized by their namespace. |
| private Navigator | navigator
model navigator |
| private static final String | |
| private final NonElement | stringType
Representation for xs:string. |
| private final TypeInfoSet |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public void | |
| public void | |
| public void | add(QName
The name of the element declaration to be added. tagName, boolean isNillable, NonElement<T, C> The type this element refers to.
Can be null, in which case the element refers to an empty anonymous complex type. type)Adds an additional element declaration. |
| private static String | |
| private static String | |
| private boolean | generateSwaRefAdapter(NonElementRef<T, C> typeRef)
Examine the specified element ref and determine if a swaRef attribute needs to be generated |
| private boolean | generateSwaRefAdapter(PropertyInfo<T, C> prop)
Examine the specified element ref and determine if a swaRef attribute needs to be generated |
| private XmlSchemaGenerator | |
| private static String | getProcessContentsModeName(WildcardMode wc)
return the string representation of the processContents mode of the give wildcard, or null if it is the schema default "strict" |
| protected static String | Returns: the relative URI or the original URI if a relative one could not be computedRelativizes a URI by using another URI (base URI.)
For example, This method only works on hierarchical URI's, not opaque URI's (refer to the java.net.URI javadoc for complete definitions of these terms. |
| private static boolean | |
| public String | |
| public void | |
| public void |
| anyType | back to summary |
|---|---|
| private final NonElement<T, C> anyType Represents xs:anyType. | |
| collisionChecker | back to summary |
|---|---|
| private final CollisionCheckStack<ClassInfo<T, C>> collisionChecker Used to detect cycles in types. | |
| errorListener | back to summary |
|---|---|
| private ErrorListener errorListener
| |
| logger | back to summary |
|---|---|
| private static final Logger logger | |
| NAMESPACE_COMPARATOR | back to summary |
|---|---|
| private static final Comparator<String> NAMESPACE_COMPARATOR JAX-RPC wants the namespaces to be sorted in the reverse order so that the empty namespace "" comes to the very end. Don't ask me why. | |
| namespaces | back to summary |
|---|---|
| private final Map<String, XmlSchemaGenerator<T, C, F, M>. Java classes to be written, organized by their namespace.
We use a | |
| navigator | back to summary |
|---|---|
| private Navigator<T, C, F, M> navigator model navigator | |
| newline | back to summary |
|---|---|
| private static final String newline | |
| stringType | back to summary |
|---|---|
| private final NonElement<T, C> stringType Representation for xs:string. | |
| types | back to summary |
|---|---|
| private final TypeInfoSet<T, C, F, M> types | |
| XmlSchemaGenerator | back to summary |
|---|---|
| public XmlSchemaGenerator(Navigator<T, C, F, M> navigator, TypeInfoSet<T, C, F, M> types) | |
| add | back to summary |
|---|---|
| public void add(ClassInfo<T, C> clazz) Adds a new class to the list of classes to be written.
A | |
| add | back to summary |
|---|---|
| public void add(ElementInfo<T, C> elem) Adds a new element to the list of elements to be written. | |
| add | back to summary |
|---|---|
| public void add(EnumLeafInfo<T, C> envm) | |
| add | back to summary |
|---|---|
| public void add(ArrayInfo<T, C> a) | |
| add | back to summary |
|---|---|
| public void add(QName tagName, boolean isNillable, NonElement<T, C> type) Adds an additional element declaration.
| |
| calculateRelativePath | back to summary |
|---|---|
| private static String calculateRelativePath(String uri, String base, boolean fileUrl) | |
| fixNull | back to summary |
|---|---|
| private static String fixNull(String s) | |
| generateSwaRefAdapter | back to summary |
|---|---|
| private boolean generateSwaRefAdapter(NonElementRef<T, C> typeRef) Examine the specified element ref and determine if a swaRef attribute needs to be generated | |
| generateSwaRefAdapter | back to summary |
|---|---|
| private boolean generateSwaRefAdapter(PropertyInfo<T, C> prop) Examine the specified element ref and determine if a swaRef attribute needs to be generated | |
| getNamespace | back to summary |
|---|---|
| private XmlSchemaGenerator | |
| getProcessContentsModeName | back to summary |
|---|---|
| private static String getProcessContentsModeName(WildcardMode wc) return the string representation of the processContents mode of the give wildcard, or null if it is the schema default "strict" | |
| relativize | back to summary |
|---|---|
| protected static String relativize(String uri, String baseUri) Relativizes a URI by using another URI (base URI.)
For example, This method only works on hierarchical URI's, not opaque URI's (refer to the java.net.URI javadoc for complete definitions of these terms. This method will not normalize the relative URI.
| |
| startsWithIgnoreCase | back to summary |
|---|---|
| private static boolean startsWithIgnoreCase(String s, String t) | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Debug information of what's in this .
| |
| write | back to summary |
|---|---|
| public void write(SchemaOutputResolver resolver, ErrorListener errorListener) throws IOException Write out the schema documents. | |
| writeEpisodeFile | back to summary |
|---|---|
| public void writeEpisodeFile(XmlSerializer out) Writes out the episode file. | |
| Modifier and Type | Class and Description |
|---|---|
| pack-priv abstract class | XmlSchemaGenerator.
Represents a global element declaration to be written. |
| pack-priv class | XmlSchemaGenerator.
|
| Modifier and Type | Field and Description |
|---|---|
| private final Set | arrays
Set of arrays in this namespace |
| private final MultiMap | attributeDecls
Global attribute declarations keyed by their local names. |
| private Form | |
| private final Set | classes
List of classes in this namespace. |
| private final Set | |
| private final MultiMap | elementDecls
Global element declarations to be written, keyed by their local names. |
| private Form | |
| private final Set | enums
Set of enums in this namespace |
| private boolean | selfReference
If this schema refers to components from this schema by itself. |
| pack-priv final String | |
| private boolean | useMimeNs
Import for mime namespace needs to be generated. |
| private boolean | useSwaRef
Does schema in this namespace uses swaRef? |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| public void | |
| public void | |
| private Tree | buildPropertyContentModel(PropertyInfo<T, C> p)
Builds content model writer for the specified property. |
| private boolean | canBeDirectElementRef(TypeRef<T, C> t, QName tn, TypeInfo<T, C> parentInfo)
Checks if we can collapse
|
| private boolean | |
| private void | handleAttributeProp(AttributePropertyInfo<T, C>
the attribute ap, AttrDecls the schema definition to which the attribute will be added attr)Generate an attribute for the specified property on the specified complexType |
| private Tree | handleElementProp(final ElementPropertyInfo<T, C>
the element property ep)Generate the proper schema fragment for the given element property into the specified schema compositor. |
| private Tree | handleMapProp(final MapPropertyInfo<T, C>
the map property mp)Generate the proper schema fragment for the given map property into the specified schema compositor. |
| private Tree | handleReferenceProp(final ReferencePropertyInfo<T, C> rp)
Generate the proper schema fragment for the given reference property into the specified schema compositor. |
| private void | processForeignNamespaces(PropertyInfo<T, C>
the PropertyInfo p, int processingDepth)Process the given PropertyInfo looking for references to namespaces that are foreign to the given namespace. |
| public String | |
| private void | |
| private void | |
| private void | writeClass(ClassInfo<T, C>
the class info c, TypeHost the writer of the parent element into which the type will be defined parent)Writes the schema definition for the specified class to the schema writer. |
| private void | writeEnum(EnumLeafInfo<T, C> e, SimpleTypeHost th)
writes the schema definition for the specified type-safe enum in the given TypeHost |
| private void | |
| private void | |
| private void | |
| private void | writeTypeRef(TypeHost th, NonElementRef<T, C> typeRef, String refAttName)
Writes a type attribute (if the referenced type is a global type) or writes out the definition of the anonymous type in place (if the referenced type is not a global type.) Also provides processing for ID/IDREF, MTOM @xmime, and swa:ref ComplexTypeHost and SimpleTypeHost don't share an api for creating and attribute in a type-safe way, so we will compromise for now and use _attribute(). |
| private void | writeTypeRef(TypeHost
the TXW interface to which the attribute will be written. th, NonElement<T, C> type to be referenced. type, String The name of the attribute used when referencing a type by QName. refAttName)Writes a type attribute (if the referenced type is a global type) or writes out the definition of the anonymous type in place (if the referenced type is not a global type.) |
| arrays | back to summary |
|---|---|
| private final Set<ArrayInfo<T, C>> arrays Set of arrays in this namespace | |
| attributeDecls | back to summary |
|---|---|
| private final MultiMap<String, AttributePropertyInfo<T, C>> attributeDecls Global attribute declarations keyed by their local names. | |
| attributeFormDefault | back to summary |
|---|---|
| private Form attributeFormDefault | |
| classes | back to summary |
|---|---|
| private final Set<ClassInfo<T, C>> classes List of classes in this namespace. | |
| depends | back to summary |
|---|---|
| private final Set<XmlSchemaGenerator<T, C, F, M>. Other | |
| elementDecls | back to summary |
|---|---|
| private final MultiMap<String, XmlSchemaGenerator<T, C, F, M>. Global element declarations to be written, keyed by their local names. | |
| elementFormDefault | back to summary |
|---|---|
| private Form elementFormDefault | |
| enums | back to summary |
|---|---|
| private final Set<EnumLeafInfo<T, C>> enums Set of enums in this namespace | |
| selfReference | back to summary |
|---|---|
| private boolean selfReference If this schema refers to components from this schema by itself. | |
| uri | back to summary |
|---|---|
| pack-priv final String uri
| |
| useMimeNs | back to summary |
|---|---|
| private boolean useMimeNs Import for mime namespace needs to be generated. See #856 | |
| useSwaRef | back to summary |
|---|---|
| private boolean useSwaRef Does schema in this namespace uses swaRef? If so, we need to generate import statement. | |
| Namespace | back to summary |
|---|---|
| public Namespace(String uri) | |
| addDependencyTo | back to summary |
|---|---|
| private void addDependencyTo(QName qname) | |
| addGlobalAttribute | back to summary |
|---|---|
| public void addGlobalAttribute(AttributePropertyInfo<T, C> ap) | |
| addGlobalElement | back to summary |
|---|---|
| public void addGlobalElement(TypeRef<T, C> tref) | |
| buildPropertyContentModel | back to summary |
|---|---|
| private Tree buildPropertyContentModel(PropertyInfo<T, C> p) Builds content model writer for the specified property. | |
| canBeDirectElementRef | back to summary |
|---|---|
| private boolean canBeDirectElementRef(TypeRef<T, C> t, QName tn, TypeInfo<T, C> parentInfo) Checks if we can collapse
| |
| containsValueProp | back to summary |
|---|---|
| private boolean containsValueProp(ClassInfo<T, C> c) | |
| handleAttributeProp | back to summary |
|---|---|
| private void handleAttributeProp(AttributePropertyInfo<T, C> ap, AttrDecls attr) Generate an attribute for the specified property on the specified complexType
| |
| handleElementProp | back to summary |
|---|---|
| private Tree handleElementProp(final ElementPropertyInfo<T, C> ep) Generate the proper schema fragment for the given element property into the specified schema compositor. The element property may or may not represent a collection and it may or may not be wrapped.
| |
| handleMapProp | back to summary |
|---|---|
| private Tree handleMapProp(final MapPropertyInfo<T, C> mp) Generate the proper schema fragment for the given map property into the specified schema compositor.
| |
| handleReferenceProp | back to summary |
|---|---|
| private Tree handleReferenceProp(final ReferencePropertyInfo<T, C> rp) Generate the proper schema fragment for the given reference property into the specified schema compositor. The reference property may or may not refer to a collection and it may or may not be wrapped. | |
| processForeignNamespaces | back to summary |
|---|---|
| private void processForeignNamespaces(PropertyInfo<T, C> p, int processingDepth) Process the given PropertyInfo looking for references to namespaces that
are foreign to the given namespace. Any foreign namespace references
found are added to the given namespaces dependency list and an
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |
| writeArray | back to summary |
|---|---|
| private void writeArray(ArrayInfo<T, C> a, Schema schema) writes the schema definition for the given array class | |
| writeAttributeTypeRef | back to summary |
|---|---|
| private void writeAttributeTypeRef(AttributePropertyInfo<T, C> ap, AttributeType a) | |
| writeClass | back to summary |
|---|---|
| private void writeClass(ClassInfo<T, C> c, TypeHost parent) Writes the schema definition for the specified class to the schema writer. | |
| writeEnum | back to summary |
|---|---|
| private void writeEnum(EnumLeafInfo<T, C> e, SimpleTypeHost th) writes the schema definition for the specified type-safe enum in the given TypeHost | |
| writeKeyOrValue | back to summary |
|---|---|
| private void writeKeyOrValue(ExplicitGroup seq, String tagName, NonElement<T, C> typeRef) | |
| writeName | back to summary |
|---|---|
| private void writeName(NonElement<T, C> c, TypedXmlWriter xw) Writes the name attribute if it's named. | |
| writeTo | back to summary |
|---|---|
| private void writeTo(Result result, Map<XmlSchemaGenerator<T, C, F, M>. Writes the schema document to the specified result.
| |
| writeTypeRef | back to summary |
|---|---|
| private void writeTypeRef(TypeHost th, NonElementRef<T, C> typeRef, String refAttName) Writes a type attribute (if the referenced type is a global type) or writes out the definition of the anonymous type in place (if the referenced type is not a global type.) Also provides processing for ID/IDREF, MTOM @xmime, and swa:ref ComplexTypeHost and SimpleTypeHost don't share an api for creating and attribute in a type-safe way, so we will compromise for now and use _attribute(). | |
| writeTypeRef | back to summary |
|---|---|
| private void writeTypeRef(TypeHost th, NonElement<T, C> type, String refAttName) Writes a type attribute (if the referenced type is a global type) or writes out the definition of the anonymous type in place (if the referenced type is not a global type.)
| |
Because multiple properties can name the same global element even if they have different Java type, the schema generator first needs to walk through the model and decide what to generate for the given element declaration.
This class represents what will be written, and its equals(Object)
method is implemented in such a way that two identical declarations
are considered as the same.
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public abstract boolean | equals(Object o)
Overrides java. Returns true if two s are representing the same schema fragment. |
| public abstract int | |
| public abstract void |
| ElementDeclaration | back to summary |
|---|---|
| pack-priv ElementDeclaration() | |
| equals | back to summary |
|---|---|
| public abstract boolean equals(Object o) Overrides java. Returns true if two s are representing the same schema fragment.
| |
| hashCode | back to summary |
|---|---|
| public abstract int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| writeTo | back to summary |
|---|---|
| public abstract void writeTo(String localName, Schema schema) Generates the declaration. | |
ElementDeclaration that refers to a NonElement.
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | |
| private final NonElement |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object o)
Implements abstract org. Returns true if two s are representing the same schema fragment. |
| public int | hashCode()
Implements abstract org. Returns a hash code value for this object. |
| public void | writeTo(String localName, Schema schema)
Implements abstract org. Generates the declaration. |
| nillable | back to summary |
|---|---|
| private final boolean nillable | |
| type | back to summary |
|---|---|
| private final NonElement<T, C> type | |
| ElementWithType | back to summary |
|---|---|
| public ElementWithType(boolean nillable, NonElement<T, C> type) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Implements abstract org. Doc from org. Returns true if two s are representing the same schema fragment.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Implements abstract org. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| writeTo | back to summary |
|---|---|
| public void writeTo(String localName, Schema schema) Implements abstract org. Doc from org. Generates the declaration.
| |