public abstract class DefaultJaxbXmlDocumentStructure extends Object implements JaxbXmlDocumentStructure
JaxbXmlDocumentStructure.| Modifier | Constructor and Description |
|---|---|
protected |
DefaultJaxbXmlDocumentStructure(JAXBContext jaxbContext,
Class<?> expectedType,
boolean isReader) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canHandleAttributes()
Returns
true if the implementation is capable of handling and providing information about attributes (#getExpectedAttributes and #getExpectedAttributesMap return valid results), false otherwise. |
void |
endElement(QName name)
Notifies this structure provider that an end element event has been fired and that the parent element of the one with
the given name should be processed.
|
Type |
getEntityType(QName entity,
boolean isAttribute)
Returns the
Type of entity (element, attribute) with the given name. |
Collection<QName> |
getExpectedAttributes()
Returns a collection of expected attributes of currently processed element.
|
Map<String,QName> |
getExpectedAttributesMap()
Returns a map of expected attributes of currently processed element where
key is represented by the local
name of the attribute and value is it's qualified name. |
Collection<QName> |
getExpectedElements()
Returns a collection of expected sub-elements of currently processed element.
|
Map<String,QName> |
getExpectedElementsMap()
Returns a map of expected sub-elements of currently processed element where
key is represented by the local
name of the sub-element and value is it's qualified name. |
Type |
getIndividualType()
Returns the
Type of individuals stored in an array/list. |
static JaxbXmlDocumentStructure |
getXmlDocumentStructure(JAXBContext jaxbContext,
Class<?> expectedType,
boolean isReader)
Creates an
JaxbXmlDocumentStructure for XMLStreamReader or
XMLStreamWriter based on a given JAXBContext. |
void |
handleAttribute(QName attributeName,
String value)
Notifies this structure provider about an attribute event with the given name has been fired and that this attribute
will be processed.
|
boolean |
isArrayCollection()
Returns
true if the currently processed element should represent an JSON array element. |
boolean |
isSameArrayCollection()
Returns
true if the currently processed element belongs to the same JSON array as the previous element. |
protected Map<String,QName> |
qnameCollectionToMap(Collection<QName> collection,
boolean elementCollection)
Transforms a collection of qualified names into a map.
|
void |
startElement(QName name)
Notifies this structure provider that a start element event with the given name has been fired and that this element
will be processed.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithasSubElementsprotected DefaultJaxbXmlDocumentStructure(JAXBContext jaxbContext, Class<?> expectedType, boolean isReader)
public static JaxbXmlDocumentStructure getXmlDocumentStructure(JAXBContext jaxbContext, Class<?> expectedType, boolean isReader) throws IllegalStateException
JaxbXmlDocumentStructure for XMLStreamReader or
XMLStreamWriter based on a given JAXBContext.jaxbContext - JAXBContext to create this JaxbXmlDocumentStructure for.expectedType - expected type that is going to be (un)marshalled.isReader - true if the instance should be created for a reader, false if the instance is intended
for a writer.JaxbXmlDocumentStructure instance for the JAXBContextIllegalStateException - if the given JAXBContext is an unsupported implementation.public Collection<QName> getExpectedElements()
JaxbXmlDocumentStructuregetExpectedElements in interface JaxbXmlDocumentStructurepublic Collection<QName> getExpectedAttributes()
JaxbXmlDocumentStructuregetExpectedAttributes in interface JaxbXmlDocumentStructurepublic Map<String,QName> getExpectedElementsMap()
JaxbXmlDocumentStructurekey is represented by the local
name of the sub-element and value is it's qualified name.getExpectedElementsMap in interface JaxbXmlDocumentStructurepublic Map<String,QName> getExpectedAttributesMap()
JaxbXmlDocumentStructurekey is represented by the local
name of the attribute and value is it's qualified name.getExpectedAttributesMap in interface JaxbXmlDocumentStructurepublic void startElement(QName name)
JaxbXmlDocumentStructurestartElement in interface JaxbXmlDocumentStructurename - name of the element that will be processed.public void endElement(QName name)
JaxbXmlDocumentStructureendElement in interface JaxbXmlDocumentStructurename - name of the ending element.public boolean canHandleAttributes()
JaxbXmlDocumentStructuretrue if the implementation is capable of handling and providing information about attributes (#getExpectedAttributes and #getExpectedAttributesMap return valid results), false otherwise.canHandleAttributes in interface JaxbXmlDocumentStructuretrue if expected attributes can be obtained, false otherwise.public Type getEntityType(QName entity, boolean isAttribute)
JaxbXmlDocumentStructureType of entity (element, attribute) with the given name. The given entity name is expected to be either
name of the current element or name of it's direct child.getEntityType in interface JaxbXmlDocumentStructureentity - name of the entity to retrieve the Type for.isAttribute - flag whether the requested entity is an attribute or not.null if the entity cannot be retrieved from the structure.public Type getIndividualType()
JaxbXmlDocumentStructureType of individuals stored in an array/list.
Note: This method should be called only if an invocation of JaxbXmlDocumentStructure.getEntityType(javax.xml.namespace.QName, boolean)
returns a collection/array type.
getIndividualType in interface JaxbXmlDocumentStructurenull if the entity cannot be retrieved from the structure.public void handleAttribute(QName attributeName, String value)
JaxbXmlDocumentStructurehandleAttribute in interface JaxbXmlDocumentStructureattributeName - name of the attribute that will be processed.value - value of the attribute.public boolean isArrayCollection()
JaxbXmlDocumentStructuretrue if the currently processed element should represent an JSON array element.isArrayCollection in interface JaxbXmlDocumentStructuretrue if the element is an JSON array element, false otherwise.public boolean isSameArrayCollection()
JaxbXmlDocumentStructuretrue if the currently processed element belongs to the same JSON array as the previous element.isSameArrayCollection in interface JaxbXmlDocumentStructuretrue if the element is an JSON array belongs to the same JSON array as the previous element,
false otherwise.protected Map<String,QName> qnameCollectionToMap(Collection<QName> collection, boolean elementCollection)
collection - collection to be transformed.elementCollection - flag whether the collection represents a collection of qualified names of elements.Copyright © 2022. All rights reserved.