Each JAXB-bound class has a corresponding JaxBeanInfo object,
which performs all the JAXB related operations on behalf of
the JAXB-bound object.
Given a class, the corresponding JaxBeanInfo can be located
via JAXBContextImpl#getBeanInfo(Class, boolean).
Typically, JaxBeanInfo implementations should be generated
by XJC/JXC. Those impl classes will register themselves to their
master ObjectFactory class.
The type parameter BeanT is the Java class of the bean that this represents.
| Modifier and Type | Field and Description |
|---|---|
| protected short | flag
Various boolean flags combined into one field to improve memory footprint. |
| private static final short | |
| private static final short | |
| private static final short | |
| private static final short | |
| private static final short | |
| private static final short | |
| private static final short | |
| private static final short | |
| protected boolean | |
| public final Class | jaxbType
Gets the JAXB bound class type that this |
| private LifecycleMethods | lcm
cache of lifecycle methods |
| private static final Logger | |
| private static Class | |
| private final Object | typeName
Type names associated with this |
| private static final Class |
| Access | Constructor and Description |
|---|---|
| protected | JaxBeanInfo(JAXBContextImpl grammar, RuntimeTypeInfo rti, Class<BeanT> jaxbType, QName[] typeNames, boolean isElement, boolean isImmutable, boolean hasLifecycleEvents)
For that has multiple type names. |
| protected | JaxBeanInfo(JAXBContextImpl grammar, RuntimeTypeInfo rti, Class<BeanT> jaxbType, QName typeName, boolean isElement, boolean isImmutable, boolean hasLifecycleEvents)
For that has one type name. |
| protected | JaxBeanInfo(JAXBContextImpl grammar, RuntimeTypeInfo rti, Class<BeanT> jaxbType, boolean isElement, boolean isImmutable, boolean hasLifecycleEvents)
For that has no type names. |
| private | JaxBeanInfo(JAXBContextImpl grammar, RuntimeTypeInfo rti, Class<BeanT> jaxbType, Object typeName, boolean isElement, boolean isImmutable, boolean hasLifecycleEvents)
|
| Modifier and Type | Method and Description |
|---|---|
| private void | cacheLifecycleMethod(Method
Method reference m, short byte representing which of the 4 lifecycle methods
is being cached lifecycleFlag)Cache a reference to the specified lifecycle method for the jaxbType associated with this beanInfo. |
| public abstract BeanT | createInstance(UnmarshallingContext
Sometimes the created bean remembers the corresponding source location, context)Creates a new instance of the bean. |
| private Method[] | |
| public abstract String | getElementLocalName(BeanT o)
Returns the local name portion of the element name, if the bean that this class represents is mapped from/to an XML element. |
| public abstract String | getElementNamespaceURI(BeanT o)
Returns the namespace URI portion of the element name, if the bean that this class represents is mapped from/to an XML element. |
| public abstract String | |
| pack-priv final LifecycleMethods | getLifecycleMethods()
Return the LifecycleMethods cache for this ClassBeanInfo's corresponding jaxbType if it exists, else return null. |
| public abstract Loader | Returns: must return non-null valid objectThe context, boolean typeSubstitutionCapable)JAXBContextImpl object that governs this object.
This object is taken as a parameter so that 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.)Gets the |
| public abstract Transducer | getTransducer()
If the bean's representation in XML is just a text,
this method return a |
| public QName | |
| public Collection | getTypeNames()
Returns XML Schema type names if the bean is mapped from a complex/simple type of XML Schema. |
| public final boolean | |
| public final boolean | |
| public final boolean | |
| public final boolean | |
| public final boolean | |
| protected final void | |
| public final void | invokeAfterUnmarshalMethod(UnmarshallerImpl unm, Object child, Object parent)
Invokes the afterUnmarshal method if applicable. |
| public final void | invokeBeforeUnmarshalMethod(UnmarshallerImpl unm, Object child, Object parent)
Invokes the beforeUnmarshal method if applicable. |
| private void | |
| public final boolean | |
| public final boolean | |
| public boolean | |
| protected void | |
| public boolean | Returns: true if the un|marshaller should look for lifecycle methods on this beanInfo, false otherwise.This method is used to determine which of the sub-classes should be interrogated for the existence of lifecycle methods. |
| private boolean | |
| public abstract boolean | Returns: true if the object was successfuly resetted. False if the object is not resettable, in which case the object will be discarded and new one will be created.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. used for reporting any errors. context)Resets the object to the initial state, as if the object is created fresh. |
| public abstract void | |
| public abstract void | serializeBody(BeanT o, XMLSerializer target)
Serializes child elements and texts into the specified target. |
| public abstract void | |
| public abstract void | serializeURIs(BeanT o, XMLSerializer target)
Declares all the namespace URIs this object is using at its top-level scope into the specified target. |
| protected final void | setLifecycleFlags()
use reflection to determine which of the 4 object lifecycle methods exist on the JAXB bound type. |
| public void | wrapUp()
Called at the end of the |
| flag | back to summary |
|---|---|
| protected short flag Various boolean flags combined into one field to improve memory footprint. | |
| FLAG_HAS_AFTER_MARSHAL_METHOD | back to summary |
|---|---|
| private static final short FLAG_HAS_AFTER_MARSHAL_METHOD | |
| FLAG_HAS_AFTER_UNMARSHAL_METHOD | back to summary |
|---|---|
| private static final short FLAG_HAS_AFTER_UNMARSHAL_METHOD | |
| FLAG_HAS_BEFORE_MARSHAL_METHOD | back to summary |
|---|---|
| private static final short FLAG_HAS_BEFORE_MARSHAL_METHOD | |
| FLAG_HAS_BEFORE_UNMARSHAL_METHOD | back to summary |
|---|---|
| private static final short FLAG_HAS_BEFORE_UNMARSHAL_METHOD | |
| FLAG_HAS_ELEMENT_ONLY_CONTENTMODEL | back to summary |
|---|---|
| private static final short FLAG_HAS_ELEMENT_ONLY_CONTENTMODEL | |
| FLAG_HAS_LIFECYCLE_EVENTS | back to summary |
|---|---|
| private static final short FLAG_HAS_LIFECYCLE_EVENTS | |
| FLAG_IS_ELEMENT | back to summary |
|---|---|
| private static final short FLAG_IS_ELEMENT | |
| FLAG_IS_IMMUTABLE | back to summary |
|---|---|
| private static final short FLAG_IS_IMMUTABLE | |
| isNilIncluded | back to summary |
|---|---|
| protected boolean isNilIncluded | |
| jaxbType | back to summary |
|---|---|
| public final Class<BeanT> jaxbType Gets the JAXB bound class type that this IOW, when a bean info object is requested for T, sometimes the bean info for one of its base classes might be returned. | |
| lcm | back to summary |
|---|---|
| private LifecycleMethods lcm cache of lifecycle methods | |
| logger | back to summary |
|---|---|
| private static final Logger logger | |
| marshalEventParams | back to summary |
|---|---|
| private static Class<T>[] marshalEventParams | |
| typeName | back to summary |
|---|---|
| private final Object typeName Type names associated with this
| |
| unmarshalEventParams | back to summary |
|---|---|
| private static final Class<T>[] unmarshalEventParams | |
| JaxBeanInfo | back to summary |
|---|---|
| protected JaxBeanInfo(JAXBContextImpl grammar, RuntimeTypeInfo rti, Class<BeanT> jaxbType, QName[] typeNames, boolean isElement, boolean isImmutable, boolean hasLifecycleEvents) For that has multiple type names. | |
| JaxBeanInfo | back to summary |
|---|---|
| protected JaxBeanInfo(JAXBContextImpl grammar, RuntimeTypeInfo rti, Class<BeanT> jaxbType, QName typeName, boolean isElement, boolean isImmutable, boolean hasLifecycleEvents) For that has one type name. | |
| JaxBeanInfo | back to summary |
|---|---|
| protected JaxBeanInfo(JAXBContextImpl grammar, RuntimeTypeInfo rti, Class<BeanT> jaxbType, boolean isElement, boolean isImmutable, boolean hasLifecycleEvents) For that has no type names. | |
| JaxBeanInfo | back to summary |
|---|---|
| private JaxBeanInfo(JAXBContextImpl grammar, RuntimeTypeInfo rti, Class<BeanT> jaxbType, Object typeName, boolean isElement, boolean isImmutable, boolean hasLifecycleEvents) | |
| cacheLifecycleMethod | back to summary |
|---|---|
| private void cacheLifecycleMethod(Method m, short lifecycleFlag) Cache a reference to the specified lifecycle method for the jaxbType associated with this beanInfo.
| |
| createInstance | back to summary |
|---|---|
| public abstract BeanT createInstance(UnmarshallingContext context) throws IllegalAccessException, InvocationTargetException, InstantiationException, SAXException Creates a new instance of the bean.
This operation is only supported when
| |
| getDeclaredMethods | back to summary |
|---|---|
| private Method[] getDeclaredMethods(final Class<BeanT> c) | |
| getElementLocalName | back to summary |
|---|---|
| public abstract String getElementLocalName(BeanT o) Returns the local name portion of the element name, if the bean that this class represents is mapped from/to an XML element.
| |
| getElementNamespaceURI | back to summary |
|---|---|
| public abstract String getElementNamespaceURI(BeanT o) Returns the namespace URI portion of the element name, if the bean that this class represents is mapped from/to an XML element.
| |
| getId | back to summary |
|---|---|
| public abstract String getId(BeanT o, XMLSerializer target) throws SAXException Gets the ID value of the given bean, if it has an ID value. Otherwise return null. | |
| getLifecycleMethods | back to summary |
|---|---|
| pack-priv final LifecycleMethods getLifecycleMethods() Return the LifecycleMethods cache for this ClassBeanInfo's corresponding jaxbType if it exists, else return null. | |
| getLoader | back to summary |
|---|---|
| public abstract Loader getLoader(JAXBContextImpl context, boolean typeSubstitutionCapable) Gets the
| |
| getTransducer | back to summary |
|---|---|
| public abstract Transducer If the bean's representation in XML is just a text,
this method return a | |
| getTypeName | back to summary |
|---|---|
| public QName getTypeName(BeanT instance) Returns the XML type name to be used to marshal the specified instance.
Most of the times the type can be determined regardless of the actual
instance, but there's a few exceptions (most notably | |
| getTypeNames | back to summary |
|---|---|
| public Collection Returns XML Schema type names if the bean is mapped from a complex/simple type of XML Schema. This is an ugly necessity to correctly handle the type substitution semantics of XML Schema. A single Java class maybe mapped to more than one XML types. All the types listed here are recognized when we are unmarshalling XML. null if the class is not bound to a named schema type. | |
| hasAfterMarshalMethod | back to summary |
|---|---|
| public final boolean hasAfterMarshalMethod() True if | |
| hasAfterUnmarshalMethod | back to summary |
|---|---|
| public final boolean hasAfterUnmarshalMethod() True if | |
| hasBeforeMarshalMethod | back to summary |
|---|---|
| public final boolean hasBeforeMarshalMethod() True if | |
| hasBeforeUnmarshalMethod | back to summary |
|---|---|
| public final boolean hasBeforeUnmarshalMethod() True if | |
| hasElementOnlyContentModel | back to summary |
|---|---|
| public final boolean hasElementOnlyContentModel() True if this bean has an element-only content model. If this flag is true, the unmarshaller can work faster by ignoring whitespaces more efficiently. | |
| hasElementOnlyContentModel | back to summary |
|---|---|
| protected final void hasElementOnlyContentModel(boolean value) True if this bean has an element-only content model. Should be considered immutable, though I can't mark it final because it cannot be computed in this constructor. | |
| invokeAfterUnmarshalMethod | back to summary |
|---|---|
| public final void invokeAfterUnmarshalMethod(UnmarshallerImpl unm, Object child, Object parent) throws SAXException Invokes the afterUnmarshal method if applicable. | |
| invokeBeforeUnmarshalMethod | back to summary |
|---|---|
| public final void invokeBeforeUnmarshalMethod(UnmarshallerImpl unm, Object child, Object parent) throws SAXException Invokes the beforeUnmarshal method if applicable. | |
| invokeUnmarshallCallback | back to summary |
|---|---|
| private void invokeUnmarshallCallback(Method m, Object child, UnmarshallerImpl unm, Object parent) throws SAXException | |
| isElement | back to summary |
|---|---|
| public final boolean isElement() Returns true if the bean is mapped to/from an XML element.
When this method returns true, | |
| isImmutable | back to summary |
|---|---|
| public final boolean isImmutable() Returns true if the bean is immutable. If this is true, Binder won't try to ueuse this object, and the unmarshaller won't create a new instance of it before it starts. | |
| isNilIncluded | back to summary |
|---|---|
| public boolean isNilIncluded() | |
| link | back to summary |
|---|---|
| protected void link(JAXBContextImpl grammar) Called after all the s are created. | |
| lookForLifecycleMethods | back to summary |
|---|---|
| public boolean lookForLifecycleMethods() This method is used to determine which of the sub-classes should be interrogated for the existence of lifecycle methods.
| |
| match | back to summary |
|---|---|
| private boolean match(Method m, Class<T>[] params) | |
| reset | back to summary |
|---|---|
| public abstract boolean reset(BeanT o, UnmarshallingContext context) throws SAXException Resets the object to the initial state, as if the object is created fresh. This is used to reuse an existing object for unmarshalling.
| |
| serializeAttributes | back to summary |
|---|---|
| public abstract void serializeAttributes(BeanT o, XMLSerializer target) throws SAXException, IOException, XMLStreamException Serializes attributes into the specified target. | |
| serializeBody | back to summary |
|---|---|
| public abstract void serializeBody(BeanT o, XMLSerializer target) throws SAXException, IOException, XMLStreamException Serializes child elements and texts into the specified target. | |
| serializeRoot | back to summary |
|---|---|
| public abstract void serializeRoot(BeanT o, XMLSerializer target) throws SAXException, IOException, XMLStreamException 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 | |
| serializeURIs | back to summary |
|---|---|
| public abstract void serializeURIs(BeanT o, XMLSerializer target) throws SAXException Declares all the namespace URIs this object is using at its top-level scope into the specified target. | |
| setLifecycleFlags | back to summary |
|---|---|
| protected final void setLifecycleFlags() use reflection to determine which of the 4 object lifecycle methods exist on the JAXB bound type.
| |
| wrapUp | back to summary |
|---|---|
| public void wrapUp() Called at the end of the | |