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

public final Class ElementBeanInfoImpl

extends JaxBeanInfo<JAXBElement<T>>
Class Inheritance
Imports
org.glassfish.jaxb.runtime.api.AccessorException, org.glassfish.jaxb.core.v2.model.core.PropertyKind, org.glassfish.jaxb.runtime.v2.model.runtime.RuntimeElementInfo, .RuntimePropertyInfo, org.glassfish.jaxb.runtime.v2.runtime.property.Property, .PropertyFactory, .UnmarshallerChain, org.glassfish.jaxb.runtime.v2.runtime.reflect.Accessor, org.glassfish.jaxb.runtime.v2.util.QNameMap, jakarta.xml.bind.JAXBElement, .JAXBException, org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.*, org.xml.sax.SAXException, javax.xml.namespace.QName, javax.xml.stream.XMLStreamException, java.io.IOException, java.lang.reflect.Constructor, .InvocationTargetException

JaxBeanInfo implementation for RuntimeElementInfo.
Author
Kohsuke Kawaguchi

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
ElementBeanInfoImpl.IntercepterLoader

Use the previous UnmarshallingContext.State's target to store JAXBElement object to be unmarshalled.

Field Summary

Modifier and TypeField and Description
private final Constructor<? extends JAXBElement<T>>
constructor

If non-null, use this to create an instance.

public final Class<T>
private Loader
private final Property<BeanT>
private final Class<T>
private final QName
Inherited from org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo:
flagisNilIncludedjaxbType

Constructor Summary

AccessConstructor and Description
pack-priv
protected
ElementBeanInfoImpl(final JAXBContextImpl grammar)

The constructor for the sole instanceof JaxBeanInfo for handling user-created JAXBElement.

Method Summary

Modifier and TypeMethod and Description
public JAXBElement<T>
createInstance(UnmarshallingContext context)

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.createInstance.

Creates a new instance of the bean.

public JAXBElement<T>
public String
getElementLocalName(JAXBElement<T> e)

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.getElementLocalName.

Returns the local name portion of the element name, if the bean that this class represents is mapped from/to an XML element.

public String
getElementNamespaceURI(JAXBElement<T> e)

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.getElementNamespaceURI.

Returns the namespace URI portion of the element name, if the bean that this class represents is mapped from/to an XML element.

public String
getId(JAXBElement<T> e, XMLSerializer target)

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.getId.

Gets the ID value of the given bean, if it has an ID value.

public Loader
getLoader(JAXBContextImpl context, boolean typeSubstitutionCapable)

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.getLoader.

Gets the Loader that will unmarshall the given object.

public Transducer<JAXBElement<T>>
getTransducer()

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.getTransducer.

If the bean's representation in XML is just a text, this method return a Transducer that lets you convert values between the text and the bean.

public boolean
reset(JAXBElement<T> e, UnmarshallingContext context)

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.reset.

Resets the object to the initial state, as if the object is created fresh.

public void
serializeAttributes(JAXBElement<T> e, XMLSerializer target)

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.serializeAttributes.

Serializes attributes into the specified target.

public void
serializeBody(JAXBElement<T> element, XMLSerializer target)

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.serializeBody.

Serializes child elements and texts into the specified target.

public void
serializeRoot(JAXBElement<T> e, XMLSerializer target)

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.serializeRoot.

Serializes the bean as the root element.

public void
serializeURIs(JAXBElement<T> e, XMLSerializer target)

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.serializeURIs.

Declares all the namespace URIs this object is using at its top-level scope into the specified target.

public void
wrapUp()

Overrides org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.wrapUp.

Called at the end of the JAXBContext initialization phase to clean up any unnecessary references.

Inherited from org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo:
getLifecycleMethodsgetTypeNamegetTypeNameshasAfterMarshalMethodhasAfterUnmarshalMethodhasBeforeMarshalMethodhasBeforeUnmarshalMethodhasElementOnlyContentModelhasElementOnlyContentModelinvokeAfterUnmarshalMethodinvokeBeforeUnmarshalMethodisElementisImmutableisNilIncludedlookForLifecycleMethodssetLifecycleFlags

Field Detail

constructorback to summary
private final Constructor<? extends JAXBElement<T>> constructor

If non-null, use this to create an instance. It takes one value.

expectedTypeback to summary
public final Class<T> expectedType
loaderback to summary
private Loader loader
propertyback to summary
private final Property<BeanT> property
scopeback to summary
private final Class<T> scope
tagNameback to summary
private final QName tagName

Constructor Detail

ElementBeanInfoImplback to summary
pack-priv ElementBeanInfoImpl(JAXBContextImpl grammar, RuntimeElementInfo rei)
ElementBeanInfoImplback to summary
protected ElementBeanInfoImpl(final JAXBContextImpl grammar)

The constructor for the sole instanceof JaxBeanInfo for handling user-created JAXBElement. Such JaxBeanInfo is used only for marshalling. This is a hack.

Method Detail

createInstanceback to summary
public JAXBElement<T> createInstance(UnmarshallingContext context) throws IllegalAccessException, InvocationTargetException, InstantiationException

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.createInstance.

Doc from org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.createInstance.

Creates a new instance of the bean.

This operation is only supported when isImmutable is false.

Annotations
@Override
createInstanceFromValueback to summary
public JAXBElement<T> createInstanceFromValue(Object o) throws IllegalAccessException, InvocationTargetException, InstantiationException
getElementLocalNameback to summary
public String getElementLocalName(JAXBElement<T> e)

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.getElementLocalName.

Doc from org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.getElementLocalName.

Returns the local name portion of the element name, if the bean that this class represents is mapped from/to an XML element.

Annotations
@Override
getElementNamespaceURIback to summary
public String getElementNamespaceURI(JAXBElement<T> e)

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.getElementNamespaceURI.

Doc from org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.getElementNamespaceURI.

Returns the namespace URI portion of the element name, if the bean that this class represents is mapped from/to an XML element.

Annotations
@Override
getIdback to summary
public String getId(JAXBElement<T> e, XMLSerializer target)

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.getId.

Doc from org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.getId.

Gets the ID value of the given bean, if it has an ID value. Otherwise return null.

Annotations
@Override
getLoaderback to summary
public Loader getLoader(JAXBContextImpl context, boolean typeSubstitutionCapable)

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.getLoader.

Doc from org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.getLoader.

Gets the Loader that will unmarshall the given object.

Annotations
@Override
getTransducerback to summary
public Transducer<JAXBElement<T>> getTransducer()

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.getTransducer.

Doc from org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.getTransducer.

If the bean's representation in XML is just a text, this method return a Transducer that lets you convert values between the text and the bean.

Annotations
@Override
resetback to summary
public boolean reset(JAXBElement<T> e, UnmarshallingContext context)

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.reset.

Doc from org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.reset.

Resets the object to the initial state, as if the object is created fresh.

This is used to reuse an existing object for unmarshalling.

Annotations
@Override
serializeAttributesback to summary
public void serializeAttributes(JAXBElement<T> e, XMLSerializer target)

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.serializeAttributes.

Doc from org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.serializeAttributes.

Serializes attributes into the specified target.

Annotations
@Override
serializeBodyback to summary
public void serializeBody(JAXBElement<T> element, XMLSerializer target) throws SAXException, IOException, XMLStreamException

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.serializeBody.

Doc from org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.serializeBody.

Serializes child elements and texts into the specified target.

Annotations
@Override
serializeRootback to summary
public void serializeRoot(JAXBElement<T> e, XMLSerializer target) throws SAXException, IOException, XMLStreamException

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.serializeRoot.

Doc from org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.serializeRoot.

Serializes the bean as the root element.

In the java-to-schema binding, an object might marshal in two different ways depending on whether it is used as the root of the graph or not. In the former case, an object could marshal as an element, whereas in the latter case, it marshals as a type.

This method is used to marshal the root of the object graph to allow this semantics to be implemented.

It is doubtful to me if it's a good idea for an object to marshal in two ways depending on the context.

For schema-to-java, this is equivalent to serializeBody(Object, XMLSerializer).

Annotations
@Override
serializeURIsback to summary
public void serializeURIs(JAXBElement<T> e, XMLSerializer target)

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.serializeURIs.

Doc from org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.serializeURIs.

Declares all the namespace URIs this object is using at its top-level scope into the specified target.

Annotations
@Override
wrapUpback to summary
public void wrapUp()

Overrides org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.wrapUp.

Doc from org.glassfish.jaxb.runtime.v2.runtime.JaxBeanInfo.wrapUp.

Called at the end of the JAXBContext initialization phase to clean up any unnecessary references.

Annotations
@Override
org.glassfish.jaxb.runtime.v2.runtime back to summary

private final Class ElementBeanInfoImpl.IntercepterLoader

extends Loader
implements Intercepter
Class Inheritance
All Implemented Interfaces
org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.Intercepter

Use the previous UnmarshallingContext.State's target to store JAXBElement object to be unmarshalled. This allows the property Loader to correctly find the parent object. This is a hack.

Field Summary

Modifier and TypeField and Description
private final Loader
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 Object
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.

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

Field Detail

coreback to summary
private final Loader core

Constructor Detail

IntercepterLoaderback to summary
public IntercepterLoader(Loader core)

Method Detail

interceptback to summary
public Object intercept(UnmarshallingContext.State state, Object o) throws SAXException

Implements org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.Intercepter.intercept.

Doc from org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.Intercepter.intercept.

Called when the child loader is deactivated.

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