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, wait
hasSubElements
protected 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 JAXBContext
IllegalStateException
- if the given JAXBContext
is an unsupported implementation.public Collection<QName> getExpectedElements()
JaxbXmlDocumentStructure
getExpectedElements
in interface JaxbXmlDocumentStructure
public Collection<QName> getExpectedAttributes()
JaxbXmlDocumentStructure
getExpectedAttributes
in interface JaxbXmlDocumentStructure
public Map<String,QName> getExpectedElementsMap()
JaxbXmlDocumentStructure
key
is represented by the local
name of the sub-element and value
is it's qualified name.getExpectedElementsMap
in interface JaxbXmlDocumentStructure
public Map<String,QName> getExpectedAttributesMap()
JaxbXmlDocumentStructure
key
is represented by the local
name of the attribute and value
is it's qualified name.getExpectedAttributesMap
in interface JaxbXmlDocumentStructure
public void startElement(QName name)
JaxbXmlDocumentStructure
startElement
in interface JaxbXmlDocumentStructure
name
- name of the element that will be processed.public void endElement(QName name)
JaxbXmlDocumentStructure
endElement
in interface JaxbXmlDocumentStructure
name
- name of the ending element.public boolean canHandleAttributes()
JaxbXmlDocumentStructure
true
if the implementation is capable of handling and providing information about attributes (#getExpectedAttributes
and #getExpectedAttributesMap
return valid results), false
otherwise.canHandleAttributes
in interface JaxbXmlDocumentStructure
true
if expected attributes can be obtained, false
otherwise.public Type getEntityType(QName entity, boolean isAttribute)
JaxbXmlDocumentStructure
Type
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 JaxbXmlDocumentStructure
entity
- 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()
JaxbXmlDocumentStructure
Type
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 JaxbXmlDocumentStructure
null
if the entity cannot be retrieved from the structure.public void handleAttribute(QName attributeName, String value)
JaxbXmlDocumentStructure
handleAttribute
in interface JaxbXmlDocumentStructure
attributeName
- name of the attribute that will be processed.value
- value of the attribute.public boolean isArrayCollection()
JaxbXmlDocumentStructure
true
if the currently processed element should represent an JSON array element.isArrayCollection
in interface JaxbXmlDocumentStructure
true
if the element is an JSON array element, false
otherwise.public boolean isSameArrayCollection()
JaxbXmlDocumentStructure
true
if the currently processed element belongs to the same JSON array as the previous element.isSameArrayCollection
in interface JaxbXmlDocumentStructure
true
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 © 2013 Oracle Corporation. All rights reserved.