Top Description Fields Constructors Methods
org.glassfish.jaxb.runtime.v2.runtime.unmarshaller

public final Class StructureLoader

extends Loader
Class Inheritance
Imports
org.glassfish.jaxb.core.Utils, org.glassfish.jaxb.runtime.api.AccessorException, .JAXBRIContext, org.glassfish.jaxb.runtime.v2.runtime.ClassBeanInfoImpl, .JAXBContextImpl, .JaxBeanInfo, org.glassfish.jaxb.runtime.v2.runtime.property.AttributeProperty, .Property, .StructureLoaderBuilder, .UnmarshallerChain, org.glassfish.jaxb.runtime.v2.runtime.reflect.Accessor, .TransducedAccessor, org.glassfish.jaxb.runtime.v2.util.QNameMap, org.xml.sax.Attributes, .SAXException, javax.xml.XMLConstants, javax.xml.namespace.QName, java.util.Collection, .HashMap, .Iterator, .Map

Loads children of an element.

This loader works with a single JaxBeanInfo and handles attributes, child elements, or child text.

Author
Kohsuke Kawaguchi

Field Summary

Modifier and TypeField and Description
private Accessor<Object, Map<QName, String>>
attCatchAll

This will receive all the attributes that were not processed.

private QNameMap<TransducedAccessor<BeanT>>
attUnmarshallers

Unmarshallers for attribute values.

private final JaxBeanInfo<BeanT>
private ChildLoader
catchAll

Loader that processes elements that didn't match anf of the childUnmarshallers.

private final QNameMap<ChildLoader>
childUnmarshallers

This map statically stores information of the unmarshaller loader and can be used while unmarshalling Since creating new QNames is expensive use this optimized version of the map

private static final QNameMap<TransducedAccessor<BeanT>>
private int
frameSize

The number of scopes this dispatcher needs to keep active.

private ChildLoader
textHandler

If we have a loader for processing text.

Inherited from org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.Loader:
expectText

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
childElement(UnmarshallingContext.State state, TagName arg)

Overrides org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.Loader.childElement.

Called when this loaderis an active loaderand we see a new child start tag.

public JaxBeanInfo<BeanT>
public Collection<QName>
getExpectedAttributes()

Overrides org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.Loader.getExpectedAttributes.

Returns a set of tag names expected as possible child elements in this context.

public Collection<QName>
getExpectedChildElements()

Overrides org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.Loader.getExpectedChildElements.

Returns a set of tag names expected as possible child elements in this context.

public void
init(JAXBContextImpl context, ClassBeanInfoImpl<BeanT> beanInfo, Accessor<?, Map<QName, String>> attWildcard)

Completes the initialization.

public void
leaveElement(UnmarshallingContext.State state, TagName ea)

Overrides org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.Loader.leaveElement.

Called when this loaderis an active loaderand we see an end tag.

public void
startElement(UnmarshallingContext.State state, TagName ea)

Overrides org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.Loader.startElement.

Called when the loader is activated, which is when a new start tag is seen and when the parent designated this loader as the child loader.

public void
text(UnmarshallingContext.State state, CharSequence text)

Overrides org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.Loader.text.

Called when this loaderis an active loaderand we see a chunk of text.

Inherited from org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.Loader:
expectTextfireAfterUnmarshalfireBeforeUnmarshalhandleGenericErrorhandleGenericExceptionhandleGenericExceptionhandleParseConversionExceptionreportErrorreportErrorreportUnexpectedChildElement

Field Detail

attCatchAllback to summary
private Accessor<Object, Map<QName, String>> attCatchAll

This will receive all the attributes that were not processed. Never be null.

attUnmarshallersback to summary
private QNameMap<TransducedAccessor<BeanT>> attUnmarshallers

Unmarshallers for attribute values. May be null if no attribute is expected and attCatchAll==null.

beanInfoback to summary
private final JaxBeanInfo<BeanT> beanInfo
catchAllback to summary
private ChildLoader catchAll

Loader that processes elements that didn't match anf of the childUnmarshallers. Can be null.

childUnmarshallersback to summary
private final QNameMap<ChildLoader> childUnmarshallers

This map statically stores information of the unmarshaller loader and can be used while unmarshalling Since creating new QNames is expensive use this optimized version of the map

EMPTYback to summary
private static final QNameMap<TransducedAccessor<BeanT>> EMPTY
frameSizeback to summary
private int frameSize

The number of scopes this dispatcher needs to keep active.

textHandlerback to summary
private ChildLoader textHandler

If we have a loader for processing text. Otherwise null.

Constructor Detail

StructureLoaderback to summary
public StructureLoader(ClassBeanInfoImpl<BeanT> beanInfo)

Method Detail

childElementback to summary
public void childElement(UnmarshallingContext.State state, TagName arg) throws SAXException

Overrides org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.Loader.childElement.

Doc from org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.Loader.childElement.

Called when this loaderis an active loaderand we see a new child start tag.

The callee is expected to designate another loaderas a loaderthat processes this element, then it should also register a Receiver. The designated loaderwill become an active loader.

The default implementation reports an error saying an element is unexpected.

Annotations
@Override
getBeanInfoback to summary
public JaxBeanInfo<BeanT> getBeanInfo()
getExpectedAttributesback to summary
public Collection<QName> getExpectedAttributes()

Overrides org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.Loader.getExpectedAttributes.

Doc from org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.Loader.getExpectedAttributes.

Returns a set of tag names expected as possible child elements in this context.

Annotations
@Override
getExpectedChildElementsback to summary
public Collection<QName> getExpectedChildElements()

Overrides org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.Loader.getExpectedChildElements.

Doc from org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.Loader.getExpectedChildElements.

Returns a set of tag names expected as possible child elements in this context.

Annotations
@Override
initback to summary
public void init(JAXBContextImpl context, ClassBeanInfoImpl<BeanT> beanInfo, Accessor<?, Map<QName, String>> attWildcard)

Completes the initialization.

To fix the cyclic reference issue, the main part of the initialization needs to be done after a is set to ClassBeanInfoImpl#loader.

leaveElementback to summary
public void leaveElement(UnmarshallingContext.State state, TagName ea) throws SAXException

Overrides org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.Loader.leaveElement.

Doc from org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.Loader.leaveElement.

Called when this loaderis an active loaderand we see an end tag.

Annotations
@Override
startElementback to summary
public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException

Overrides org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.Loader.startElement.

Doc from org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.Loader.startElement.

Called when the loader is activated, which is when a new start tag is seen and when the parent designated this loader as the child loader.

The callee may change state.loader to designate another for the processing. It's the responsibility of the callee to forward the startElement event in such a case.

Annotations
@Override
textback to summary
public void text(UnmarshallingContext.State state, CharSequence text) throws SAXException

Overrides org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.Loader.text.

Doc from org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.Loader.text.

Called when this loaderis an active loaderand we see a chunk of text. The runtime makes sure that adjacent characters (even those separated by comments, PIs, etc) are reported as one event. IOW, you won't see two text event calls in a row.

Annotations
@Override