public final class XmlSchemaStateMachineNode
extends java.lang.Object
Document based on its
XmlSchema and Avro
org.apache.avro.Schema.
A SchemaStateMachineNode represents one of:
Document is traversed, the state machine is used to
determine how to process the current element. Two passes will be needed: the
first pass will determine the correct path through the document's schema in
order to properly parse the elements, and the second traversal will read the
elements while following that path.| Modifier and Type | Class and Description |
|---|---|
static class |
XmlSchemaStateMachineNode.Type |
| Modifier and Type | Field and Description |
|---|---|
private XmlSchemaAny |
any |
private java.util.List<XmlSchemaAttrInfo> |
attributes |
private XmlSchemaElement |
element |
private long |
maxOccurs |
private long |
minOccurs |
private XmlSchemaStateMachineNode.Type |
nodeType |
private java.util.List<XmlSchemaStateMachineNode> |
possibleNextStates |
private XmlSchemaTypeInfo |
typeInfo |
| Constructor and Description |
|---|
XmlSchemaStateMachineNode(XmlSchemaAny any)
Constructs a
XmlSchemaStateMachineNode from the
XmlSchemaAny. |
XmlSchemaStateMachineNode(XmlSchemaElement elem,
java.util.List<XmlSchemaAttrInfo> attrs,
XmlSchemaTypeInfo typeInfo)
Constructs a new
SchemaStateMachineNode for an element. |
XmlSchemaStateMachineNode(XmlSchemaStateMachineNode.Type nodeType,
long minOccurs,
long maxOccurs)
Constructs a new
SchemaStateMachineNode for a group. |
| Modifier and Type | Method and Description |
|---|---|
(package private) XmlSchemaStateMachineNode |
addPossibleNextState(XmlSchemaStateMachineNode next)
Adds a state that could follow this
SchemaStateMachineNode. |
(package private) XmlSchemaStateMachineNode |
addPossibleNextStates(java.util.Collection<XmlSchemaStateMachineNode> nextStates)
Adds the set of possible states that could follow this
SchemaStateMachineNode. |
XmlSchemaAny |
getAny()
Returns the
XmlSchemaAny associated with this node, or
null if none. |
java.util.List<XmlSchemaAttrInfo> |
getAttributes()
If this
SchemaStateMachineNode represents an
XmlSchemaElement, the set of XmlSchemaAttrInfos
associated with the element it represents. |
XmlSchemaElement |
getElement()
|
XmlSchemaTypeInfo |
getElementType()
If this
SchemaStateMachineNode represents an
XmlSchemaElement, the XmlSchemaTypeInfo of the element it
represents. |
long |
getMaxOccurs()
The maximum number of times this
SchemaStateMachineNode may
appear in succession. |
long |
getMinOccurs()
The minimum number of times this
SchemaStateMachineNode may
appear in succession. |
XmlSchemaStateMachineNode.Type |
getNodeType()
The XML Schema node
XmlSchemaStateMachineNode.Type this SchemaStateMachineNode
represents. |
java.util.List<XmlSchemaStateMachineNode> |
getPossibleNextStates()
All of the known possible states that could follow this one.
|
java.lang.String |
toString()
Builds a
String representing this
XmlSchemaStateMachineNode. |
private final XmlSchemaStateMachineNode.Type nodeType
private final XmlSchemaElement element
private final java.util.List<XmlSchemaAttrInfo> attributes
private final XmlSchemaTypeInfo typeInfo
private final long minOccurs
private final long maxOccurs
private final XmlSchemaAny any
private java.util.List<XmlSchemaStateMachineNode> possibleNextStates
XmlSchemaStateMachineNode(XmlSchemaStateMachineNode.Type nodeType, long minOccurs, long maxOccurs)
SchemaStateMachineNode for a group.nodeType - The type of the group node (XmlSchemaStateMachineNode.Type.ALL,
XmlSchemaStateMachineNode.Type.SUBSTITUTION_GROUP, XmlSchemaStateMachineNode.Type.CHOICE,
XmlSchemaStateMachineNode.Type.SEQUENCE, or XmlSchemaStateMachineNode.Type.ANY).minOccurs - The minimum number of occurrences of this group.maxOccurs - The maximum number of occurrences of this group.java.lang.IllegalArgumentException - if this constructor is used to define an
XmlSchemaStateMachineNode.Type.ELEMENT or an XmlSchemaStateMachineNode.Type.ANY.XmlSchemaStateMachineNode(XmlSchemaElement elem, java.util.List<XmlSchemaAttrInfo> attrs, XmlSchemaTypeInfo typeInfo)
SchemaStateMachineNode for an element.elem - The XmlSchemaElement this node represents.attrs - The XmlSchemaAttribute contained by this element. An
empty List or null if none.typeInfo - The type information, if the element has simple content.
null if not.XmlSchemaStateMachineNode(XmlSchemaAny any)
XmlSchemaStateMachineNode from the
XmlSchemaAny.any - The XmlSchemaAny to construct the node from.public XmlSchemaStateMachineNode.Type getNodeType()
XmlSchemaStateMachineNode.Type this SchemaStateMachineNode
represents.public XmlSchemaElement getElement()
public XmlSchemaTypeInfo getElementType()
SchemaStateMachineNode represents an
XmlSchemaElement, the XmlSchemaTypeInfo of the element it
represents.public java.util.List<XmlSchemaAttrInfo> getAttributes()
SchemaStateMachineNode represents an
XmlSchemaElement, the set of XmlSchemaAttrInfos
associated with the element it represents.public long getMinOccurs()
SchemaStateMachineNode may
appear in succession.public long getMaxOccurs()
SchemaStateMachineNode may
appear in succession.public XmlSchemaAny getAny()
XmlSchemaAny associated with this node, or
null if none.XmlSchemaStateMachineNode addPossibleNextState(XmlSchemaStateMachineNode next)
SchemaStateMachineNode.next - A node that could follow this one in the XML document.XmlSchemaStateMachineNode addPossibleNextStates(java.util.Collection<XmlSchemaStateMachineNode> nextStates)
SchemaStateMachineNode.nextStates - The set of possible nodes that could follow this one in
the XML document.public java.util.List<XmlSchemaStateMachineNode> getPossibleNextStates()
public java.lang.String toString()
String representing this
XmlSchemaStateMachineNode.toString in class java.lang.Object