com.sun.xml.bind.v2.runtime

Class JAXBContextImpl

public final class JAXBContextImpl extends JAXBRIContext

This class provides the implementation of JAXBContext.
Nested Class Summary
static classJAXBContextImpl.JAXBContextBuilder
Field Summary
booleanallNillable
RuntimeAnnotationReaderannotationReader
protected Map<RuntimeTypeInfo,JaxBeanInfo>beanInfos
All created JaxBeanInfos.
protected booleanc14nSupport
true to reorder attributes lexicographically in preparation of the c14n support.
booleanfastBoot
If true, we aim for faster JAXBContext instanciation performance, instead of going after efficient sustained unmarshalling/marshalling performance.
booleanimprovedXsiTypeHandling
Improved xsi type handling.
Pool<Marshaller>marshallerPool
Pool of Marshallers.
NameBuildernameBuilder
Used to assign indices to known names in this grammar.
NameListnameList
Keeps the list of known names.
booleanretainPropertyInfo
Store properties, so that they can be recovered in the run (is here because of JSON encoding of Jersey).
Map<Class,Class>subclassReplacements
booleansupressAccessorWarnings
Supress reflection accessor warnings.
Pool<Unmarshaller>unmarshallerPool
booleanxmlAccessorFactorySupport
Flag that user has provided a custom AccessorFactory for JAXB to use
Method Summary
JAXBContextImplcreateAugmented(Class<?> clazz)
Creates a JAXBContextImpl that includes the specified additional classes.
<T> Binder<T>createBinder(Class<T> domType)
Binder<Node>createBinder()
BridgecreateBridge(TypeReference ref)
BridgeContextcreateBridgeContext()
static DocumentcreateDom()
Creates a new DOM document.
JAXBIntrospectorcreateJAXBIntrospector()
MarshallerImplcreateMarshaller()
SchemaOutputResolvercreateTestResolver()
Used for testing.
static TransformercreateTransformer()
Creates a new identity transformer.
static TransformerHandlercreateTransformerHandler()
Creates a new identity transformer.
UnmarshallerImplcreateUnmarshaller()
ValidatorcreateValidator()
voidgenerateEpisode(Result output)
voidgenerateSchema(SchemaOutputResolver outputResolver)
JaxBeanInfogetBeanInfo(Object o)
Gets the JaxBeanInfo object that can handle the given JAXB-bound object.
JaxBeanInfogetBeanInfo(Object o, boolean fatal)
Gets the JaxBeanInfo object that can handle the given JAXB-bound object.
<T> JaxBeanInfo<T>getBeanInfo(Class<T> clazz)
Gets the JaxBeanInfo object that can handle the given JAXB-bound class.
<T> JaxBeanInfo<T>getBeanInfo(Class<T> clazz, boolean fatal)
Gets the JaxBeanInfo object that can handle the given JAXB-bound class.
StringgetBuildId()
ElementBeanInfoImplgetElement(Class scope, QName name)
QNamegetElementName(Object o)
QNamegetElementName(Class o)
RawAccessorgetElementPropertyAccessor(Class wrapperBean, String nsUri, String localName)
JaxBeanInfogetGlobalType(QName name)
Gets the JaxBeanInfo for the given named XML Schema type.
List<String>getKnownNamespaceURIs()
StringgetNearestTypeName(QName name)
Finds a type name that this context recognizes which is "closest" to the given type name.
intgetNumberOfAttributeNames()
intgetNumberOfElementNames()
intgetNumberOfLocalNames()
protected JaxBeanInfogetOrCreate(RuntimeEnumLeafInfo eli)
protected ClassBeanInfoImplgetOrCreate(RuntimeClassInfo ci)
protected JaxBeanInfogetOrCreate(RuntimeArrayInfo ai)
JaxBeanInfogetOrCreate(RuntimeTypeInfo e)
RuntimeTypeInfoSetgetRuntimeTypeInfoSet()
RuntimeTypeInfoSetgetTypeInfoSet()
Creates a RuntimeTypeInfoSet.
QNamegetTypeName(TypeReference tr)
Encoded[]getUTF8NameTable()
Set<QName>getValidRootNames()
Returns the set of valid root tag names.
Set<XmlNs>getXmlNsSet()
Returns declared XmlNs annotations (from package-level annotation XmlSchema
StringgetXMIMEContentType(Object o)
Gets the value of the xmime:contentType attribute on the given object, or null if for some reason it couldn't be found, including any error.
booleanhasSwaRef()
True if this JAXBContext has XmlAttachmentRef.
LoaderselectRootLoader(UnmarshallingContext.State state, TagName tag)
Based on the tag name, determine what object to unmarshal, and then set a new object and its loader to the current unmarshaller state.
StringtoString()

Field Detail

allNillable

public final boolean allNillable

See Also: TREAT_EVERYTHING_NILLABLE

annotationReader

RuntimeAnnotationReader annotationReader

beanInfos

protected Map<RuntimeTypeInfo,JaxBeanInfo> beanInfos
All created JaxBeanInfos. Updated from each JaxBeanInfos constructors to avoid infinite recursion for a cyclic reference.

This map is only used while the JAXBContextImpl is built and set to null to avoid keeping references too long.

c14nSupport

protected final boolean c14nSupport
true to reorder attributes lexicographically in preparation of the c14n support.

fastBoot

public final boolean fastBoot
If true, we aim for faster JAXBContext instanciation performance, instead of going after efficient sustained unmarshalling/marshalling performance.

Since: 2.0.4

improvedXsiTypeHandling

public final boolean improvedXsiTypeHandling
Improved xsi type handling.

marshallerPool

public final Pool<Marshaller> marshallerPool
Pool of Marshallers.

nameBuilder

public NameBuilder nameBuilder
Used to assign indices to known names in this grammar. Reset to null once the build phase is completed.

nameList

public final NameList nameList
Keeps the list of known names. This field is set once the build pahse is completed.

retainPropertyInfo

public final boolean retainPropertyInfo
Store properties, so that they can be recovered in the run (is here because of JSON encoding of Jersey).

subclassReplacements

Map<Class,Class> subclassReplacements

supressAccessorWarnings

public final boolean supressAccessorWarnings
Supress reflection accessor warnings.

unmarshallerPool

public final Pool<Unmarshaller> unmarshallerPool

xmlAccessorFactorySupport

public final boolean xmlAccessorFactorySupport
Flag that user has provided a custom AccessorFactory for JAXB to use

Method Detail

createAugmented

public JAXBContextImpl createAugmented(Class<?> clazz)
Creates a JAXBContextImpl that includes the specified additional classes.

createBinder

<T> Binder<T> createBinder(Class<T> domType)

createBinder

Binder<Node> createBinder()

createBridge

public Bridge createBridge(TypeReference ref)

createBridgeContext

BridgeContext createBridgeContext()

createDom

static Document createDom()
Creates a new DOM document.

createJAXBIntrospector

JAXBIntrospector createJAXBIntrospector()

createMarshaller

public MarshallerImpl createMarshaller()

createTestResolver

public SchemaOutputResolver createTestResolver()
Used for testing.

createTransformer

static Transformer createTransformer()
Creates a new identity transformer.

createTransformerHandler

public static TransformerHandler createTransformerHandler()
Creates a new identity transformer.

createUnmarshaller

public UnmarshallerImpl createUnmarshaller()

createValidator

public Validator createValidator()

generateEpisode

void generateEpisode(Result output)

generateSchema

void generateSchema(SchemaOutputResolver outputResolver)

getBeanInfo

public final JaxBeanInfo getBeanInfo(Object o)
Gets the JaxBeanInfo object that can handle the given JAXB-bound object.

This method traverses the base classes of the given object.

Returns: null if c isn't a JAXB-bound class and fatal==false.

getBeanInfo

public final JaxBeanInfo getBeanInfo(Object o, boolean fatal)
Gets the JaxBeanInfo object that can handle the given JAXB-bound object.

Parameters: fatal if true, the failure to look up will throw an exception. Otherwise it will just return null.

getBeanInfo

public final <T> JaxBeanInfo<T> getBeanInfo(Class<T> clazz)
Gets the JaxBeanInfo object that can handle the given JAXB-bound class.

This method doesn't look for base classes.

Returns: null if c isn't a JAXB-bound class and fatal==false.

getBeanInfo

public final <T> JaxBeanInfo<T> getBeanInfo(Class<T> clazz, boolean fatal)
Gets the JaxBeanInfo object that can handle the given JAXB-bound class.

Parameters: fatal if true, the failure to look up will throw an exception. Otherwise it will just return null.

getBuildId

public String getBuildId()

getElement

public ElementBeanInfoImpl getElement(Class scope, QName name)

getElementName

public QName getElementName(Object o)

getElementName

public QName getElementName(Class o)

getElementPropertyAccessor

public RawAccessor getElementPropertyAccessor(Class wrapperBean, String nsUri, String localName)

getGlobalType

public JaxBeanInfo getGlobalType(QName name)
Gets the JaxBeanInfo for the given named XML Schema type.

Returns: null if the type name is not recognized. For schema languages other than XML Schema, this method always returns null.

getKnownNamespaceURIs

public List<String> getKnownNamespaceURIs()

getNearestTypeName

public String getNearestTypeName(QName name)
Finds a type name that this context recognizes which is "closest" to the given type name.

This method is used for error recovery.

getNumberOfAttributeNames

public int getNumberOfAttributeNames()

getNumberOfElementNames

public int getNumberOfElementNames()

getNumberOfLocalNames

public int getNumberOfLocalNames()

getOrCreate

protected JaxBeanInfo getOrCreate(RuntimeEnumLeafInfo eli)

getOrCreate

protected ClassBeanInfoImpl getOrCreate(RuntimeClassInfo ci)

getOrCreate

protected JaxBeanInfo getOrCreate(RuntimeArrayInfo ai)

getOrCreate

public JaxBeanInfo getOrCreate(RuntimeTypeInfo e)

getRuntimeTypeInfoSet

public RuntimeTypeInfoSet getRuntimeTypeInfoSet()

getTypeInfoSet

public RuntimeTypeInfoSet getTypeInfoSet()
Creates a RuntimeTypeInfoSet.

getTypeName

public QName getTypeName(TypeReference tr)

getUTF8NameTable

public Encoded[] getUTF8NameTable()

getValidRootNames

public Set<QName> getValidRootNames()
Returns the set of valid root tag names. For diagnostic use.

getXmlNsSet

public Set<XmlNs> getXmlNsSet()
Returns declared XmlNs annotations (from package-level annotation XmlSchema

Returns: set of all present XmlNs annotations

getXMIMEContentType

public String getXMIMEContentType(Object o)
Gets the value of the xmime:contentType attribute on the given object, or null if for some reason it couldn't be found, including any error.

hasSwaRef

public boolean hasSwaRef()
True if this JAXBContext has XmlAttachmentRef.

selectRootLoader

public final Loader selectRootLoader(UnmarshallingContext.State state, TagName tag)
Based on the tag name, determine what object to unmarshal, and then set a new object and its loader to the current unmarshaller state.

Returns: null if the given name pair is not recognized.

toString

String toString()