public final class ElementBeanInfoImpl extends JaxBeanInfo<JAXBElement>
JaxBeanInfo implementation for RuntimeElementInfo.| Modifier and Type | Field and Description |
|---|---|
Class |
expectedType |
flag, isNilIncluded, jaxbType| Modifier | Constructor and Description |
|---|---|
protected |
ElementBeanInfoImpl(JAXBContextImpl grammar)
The constructor for the sole instanceof
JaxBeanInfo for
handling user-created JAXBElement. |
| Modifier and Type | Method and Description |
|---|---|
JAXBElement |
createInstance(UnmarshallingContext context)
Creates a new instance of the bean.
|
JAXBElement |
createInstanceFromValue(Object o) |
String |
getElementLocalName(JAXBElement e)
Returns the local name portion of the element name,
if the bean that this class represents is mapped from/to
an XML element.
|
String |
getElementNamespaceURI(JAXBElement e)
Returns the namespace URI portion of the element name,
if the bean that this class represents is mapped from/to
an XML element.
|
String |
getId(JAXBElement e,
XMLSerializer target)
Gets the ID value of the given bean, if it has an ID value.
|
Loader |
getLoader(JAXBContextImpl context,
boolean typeSubstitutionCapable)
Gets the
Loader that will unmarshall the given object. |
Transducer<JAXBElement> |
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. |
void |
link(JAXBContextImpl grammar)
Called after all the
JaxBeanInfos are created. |
boolean |
reset(JAXBElement e,
UnmarshallingContext context)
Resets the object to the initial state, as if the object
is created fresh.
|
void |
serializeAttributes(JAXBElement e,
XMLSerializer target)
Serializes attributes into the specified target.
|
void |
serializeBody(JAXBElement element,
XMLSerializer target)
Serializes child elements and texts into the specified target.
|
void |
serializeRoot(JAXBElement e,
XMLSerializer target)
Serializes the bean as the root element.
|
void |
serializeURIs(JAXBElement e,
XMLSerializer target)
Declares all the namespace URIs this object is using at
its top-level scope into the specified target.
|
void |
wrapUp()
Called at the end of the
JAXBContext initialization phase
to clean up any unnecessary references. |
getLifecycleMethods, getTypeName, getTypeNames, hasAfterMarshalMethod, hasAfterUnmarshalMethod, hasBeforeMarshalMethod, hasBeforeUnmarshalMethod, hasElementOnlyContentModel, hasElementOnlyContentModel, invokeAfterUnmarshalMethod, invokeBeforeUnmarshalMethod, isElement, isImmutable, isNilIncluded, lookForLifecycleMethods, setLifecycleFlagspublic final Class expectedType
protected ElementBeanInfoImpl(JAXBContextImpl grammar)
JaxBeanInfo for
handling user-created JAXBElement.
Such JaxBeanInfo is used only for marshalling.
This is a hack.public String getElementNamespaceURI(JAXBElement e)
JaxBeanInfogetElementNamespaceURI in class JaxBeanInfo<JAXBElement>public String getElementLocalName(JAXBElement e)
JaxBeanInfogetElementLocalName in class JaxBeanInfo<JAXBElement>public Loader getLoader(JAXBContextImpl context, boolean typeSubstitutionCapable)
JaxBeanInfoLoader that will unmarshall the given object.getLoader in class JaxBeanInfo<JAXBElement>context - The JAXBContextImpl object that governs this object.
This object is taken as a parameter so that JaxBeanInfo doesn't have
to store them on its own.
When this method is invoked from within the unmarshaller, tihs parameter can be
null (because the loader is constructed already.)typeSubstitutionCapable - If true, the returned Loader is capable of recognizing @xsi:type (if necessary)
and unmarshals a subtype. This allowes an optimization where this bean info
is guaranteed not to have a type substitution.
If false, the returned Loader doesn't look for @xsi:type.public final JAXBElement createInstance(UnmarshallingContext context) throws IllegalAccessException, InvocationTargetException, InstantiationException
JaxBeanInfo
This operation is only supported when JaxBeanInfo.isImmutable() is false.
createInstance in class JaxBeanInfo<JAXBElement>context - Sometimes the created bean remembers the corresponding source location,IllegalAccessExceptionInvocationTargetExceptionInstantiationExceptionpublic final JAXBElement createInstanceFromValue(Object o) throws IllegalAccessException, InvocationTargetException, InstantiationException
public boolean reset(JAXBElement e, UnmarshallingContext context)
JaxBeanInfoThis is used to reuse an existing object for unmarshalling.
reset in class JaxBeanInfo<JAXBElement>context - used for reporting any errors.If the object is resettable but failed by an error, it should be reported to the context, then return false. If the object is not resettable to begin with, do not report an error.
public String getId(JAXBElement e, XMLSerializer target)
JaxBeanInfogetId in class JaxBeanInfo<JAXBElement>public void serializeBody(JAXBElement element, XMLSerializer target) throws SAXException, IOException, XMLStreamException
JaxBeanInfoserializeBody in class JaxBeanInfo<JAXBElement>SAXExceptionIOExceptionXMLStreamExceptionpublic void serializeRoot(JAXBElement e, XMLSerializer target) throws SAXException, IOException, XMLStreamException
JaxBeanInfoIn 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 JaxBeanInfo.serializeBody(Object, XMLSerializer).
serializeRoot in class JaxBeanInfo<JAXBElement>SAXExceptionIOExceptionXMLStreamExceptionpublic void serializeAttributes(JAXBElement e, XMLSerializer target)
JaxBeanInfoserializeAttributes in class JaxBeanInfo<JAXBElement>public void serializeURIs(JAXBElement e, XMLSerializer target)
JaxBeanInfoserializeURIs in class JaxBeanInfo<JAXBElement>public final Transducer<JAXBElement> getTransducer()
JaxBeanInfoTransducer that lets you convert
values between the text and the bean.getTransducer in class JaxBeanInfo<JAXBElement>public void wrapUp()
JaxBeanInfoJAXBContext initialization phase
to clean up any unnecessary references.wrapUp in class JaxBeanInfo<JAXBElement>public void link(JAXBContextImpl grammar)
JaxBeanInfoJaxBeanInfos are created.link in class JaxBeanInfo<JAXBElement>Copyright © 2017 JBoss by Red Hat. All rights reserved.