Class JAXBContextImpl
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionfinal boolean
If true, despite the specification, unmarshall child element with parent namespace, if child namespace is not specified.protected Map<RuntimeTypeInfo,
JaxBeanInfo> All createdJaxBeanInfo
s.protected final boolean
true to reorder attributes lexicographically in preparation of the c14n support.final boolean
Disable security processing.final boolean
If true, we aim for fasterJAXBContext
instantiation performance, instead of going after efficient sustained unmarshalling/marshalling performance.final boolean
Improved xsi type handling.final Pool<javax.xml.bind.Marshaller>
Pool ofMarshaller
s.final int
The maximum number of errors unmarshall operation reports.Used to assign indices to known names in this grammar.final NameList
Keeps the list of known names.final boolean
Store properties, so that they can be recovered in the run (is here because of JSON encoding of Jersey).final boolean
Suppress reflection accessor warnings.final Pool<javax.xml.bind.Unmarshaller>
final boolean
Flag that user has provided a custom AccessorFactory for JAXB to useFields inherited from class com.sun.xml.bind.api.JAXBRIContext
ANNOTATION_READER, BACKUP_WITH_PARENT_NAMESPACE, CANONICALIZATION_SUPPORT, DEFAULT_NAMESPACE_REMAP, DISABLE_XML_SECURITY, ENABLE_XOP, IMPROVED_XSI_TYPE_HANDLING, MAX_ERRORS, RETAIN_REFERENCE_TO_INFO, SUBCLASS_REPLACEMENTS, SUPRESS_ACCESSOR_WARNINGS, TREAT_EVERYTHING_NILLABLE, TYPE_REFERENCES, XMLACCESSORFACTORY_SUPPORT
Fields inherited from class javax.xml.bind.JAXBContext
JAXB_CONTEXT_FACTORY
-
Method Summary
Modifier and TypeMethodDescriptioncreateAugmented
(Class<?> clazz) Creates aJAXBContextImpl
that includes the specified additional classes.javax.xml.bind.Binder<Node>
<T> javax.xml.bind.Binder<T>
createBinder
(Class<T> domType) Creates a mini-marshaller/unmarshaller that can process aTypeReference
.Creates a newBridgeContext
instance.javax.xml.bind.JAXBIntrospector
static TransformerHandler
createTransformerHandler
(boolean disableSecureProcessing) Creates a new identity transformer.javax.xml.bind.Validator
void
generateEpisode
(Result output) Generates the episode file that represents the binding known to thisJAXBContext
, so that XJC can later do separate compilation.void
generateSchema
(javax.xml.bind.SchemaOutputResolver outputResolver) Generates the schema documents from the model.final <T> JaxBeanInfo<T>
getBeanInfo
(Class<T> clazz) Gets theJaxBeanInfo
object that can handle the given JAXB-bound class.final <T> JaxBeanInfo<T>
getBeanInfo
(Class<T> clazz, boolean fatal) Gets theJaxBeanInfo
object that can handle the given JAXB-bound class.final JaxBeanInfo
Gets theJaxBeanInfo
object that can handle the given JAXB-bound object.final JaxBeanInfo
getBeanInfo
(Object o, boolean fatal) Gets theJaxBeanInfo
object that can handle the given JAXB-bound object.Gets the build information of the JAXB runtime.getElement
(Class scope, QName name) Allows to retrieve the element name based on Class.If the given object is bound to an element in XML by JAXB, returns the element name.getElementPropertyAccessor
(Class wrapperBean, String nsUri, String localName) Gets aRawAccessor
for the specified element property of the specified wrapper bean class.getGlobalType
(QName name) Gets theJaxBeanInfo
for the given named XML Schema type.Gets the namespace URIs statically known to thisJAXBContext
.getNearestTypeName
(QName name) Finds a type name that this context recognizes which is "closest" to the given type name.int
int
int
protected JaxBeanInfo
protected ClassBeanInfoImpl
protected JaxBeanInfo
Allows you to access the runtime model information of the JAXB XML/Java binding.Creates aRuntimeTypeInfoSet
.Returns the name of the XML Type bound to the specified Java type.Encoded[]
Returns the set of valid root tag names.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.Set<javax.xml.bind.annotation.XmlNs>
Returns declared XmlNs annotations (from package-level annotation XmlSchemaboolean
True if this JAXBContext hasXmlAttachmentRef
.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.toString()
Methods inherited from class com.sun.xml.bind.api.JAXBRIContext
getBaseType, mangleNameToClassName, mangleNameToPropertyName, mangleNameToVariableName, newInstance, newInstance, newInstance
Methods inherited from class javax.xml.bind.JAXBContext
newInstance, newInstance, newInstance, newInstance, newInstance
-
Field Details
-
beanInfos
All createdJaxBeanInfo
s. Updated from eachJaxBeanInfo
s 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. -
marshallerPool
Pool ofMarshaller
s. -
unmarshallerPool
-
nameBuilder
Used to assign indices to known names in this grammar. Reset to null once the build phase is completed. -
nameList
Keeps the list of known names. This field is set once the build pahse is completed. -
c14nSupport
protected final boolean c14nSupporttrue to reorder attributes lexicographically in preparation of the c14n support. -
xmlAccessorFactorySupport
public final boolean xmlAccessorFactorySupportFlag that user has provided a custom AccessorFactory for JAXB to use -
allNillable
public final boolean allNillable- See Also:
-
retainPropertyInfo
public final boolean retainPropertyInfoStore properties, so that they can be recovered in the run (is here because of JSON encoding of Jersey). -
supressAccessorWarnings
public final boolean supressAccessorWarningsSuppress reflection accessor warnings. -
improvedXsiTypeHandling
public final boolean improvedXsiTypeHandlingImproved xsi type handling. -
disableSecurityProcessing
public final boolean disableSecurityProcessingDisable security processing. -
fastBoot
public final boolean fastBootIf true, we aim for fasterJAXBContext
instantiation performance, instead of going after efficient sustained unmarshalling/marshalling performance.- Since:
- 2.0.4
-
backupWithParentNamespace
If true, despite the specification, unmarshall child element with parent namespace, if child namespace is not specified. The default value is null for System {code}com.sun.xml.bind.backupWithParentNamespace{code} property to be used, and false is assumed if it's not set either. Boolean- Since:
- 2.3.0
-
maxErrorsCount
public final int maxErrorsCountThe maximum number of errors unmarshall operation reports. Use negative value to report all errors. The default value is 10.- Since:
- 2.3.3
-
-
Method Details
-
getXmlNsSet
Returns declared XmlNs annotations (from package-level annotation XmlSchema- Returns:
- set of all present XmlNs annotations
-
hasSwaRef
public boolean hasSwaRef()True if this JAXBContext hasXmlAttachmentRef
.- Specified by:
hasSwaRef
in classJAXBRIContext
-
getRuntimeTypeInfoSet
Description copied from class:JAXBRIContext
Allows you to access the runtime model information of the JAXB XML/Java binding.This is useful for doing a deeper integration with the JAXB RI. For more information about the model, see https://jaxb2-reflection.dev.java.net/
- Specified by:
getRuntimeTypeInfoSet
in classJAXBRIContext
-
getTypeInfoSet
Creates aRuntimeTypeInfoSet
.- Throws:
IllegalAnnotationsException
-
getElement
-
getOrCreate
-
getOrCreate
-
getOrCreate
-
getOrCreate
-
getBeanInfo
Gets theJaxBeanInfo
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 andfatal==false
.
-
getBeanInfo
Gets theJaxBeanInfo
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.- Throws:
javax.xml.bind.JAXBException
-
getBeanInfo
Gets theJaxBeanInfo
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 andfatal==false
.
-
getBeanInfo
public final <T> JaxBeanInfo<T> getBeanInfo(Class<T> clazz, boolean fatal) throws javax.xml.bind.JAXBException Gets theJaxBeanInfo
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.- Throws:
javax.xml.bind.JAXBException
-
selectRootLoader
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.
-
getGlobalType
Gets theJaxBeanInfo
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.
-
getNearestTypeName
Finds a type name that this context recognizes which is "closest" to the given type name.This method is used for error recovery.
-
getValidRootNames
Returns the set of valid root tag names. For diagnostic use. -
getUTF8NameTable
-
getNumberOfLocalNames
public int getNumberOfLocalNames() -
getNumberOfElementNames
public int getNumberOfElementNames() -
getNumberOfAttributeNames
public int getNumberOfAttributeNames() -
createTransformerHandler
Creates a new identity transformer. -
createMarshaller
- Specified by:
createMarshaller
in classjavax.xml.bind.JAXBContext
-
createUnmarshaller
- Specified by:
createUnmarshaller
in classjavax.xml.bind.JAXBContext
-
createValidator
public javax.xml.bind.Validator createValidator()- Specified by:
createValidator
in classjavax.xml.bind.JAXBContext
-
createJAXBIntrospector
public javax.xml.bind.JAXBIntrospector createJAXBIntrospector()- Overrides:
createJAXBIntrospector
in classjavax.xml.bind.JAXBContext
-
generateEpisode
Description copied from class:JAXBRIContext
Generates the episode file that represents the binding known to thisJAXBContext
, so that XJC can later do separate compilation.Episode file is really just a JAXB customization file, except that currently we use the RI-specific SCD to refer to schema components.
- Specified by:
generateEpisode
in classJAXBRIContext
- Parameters:
output
- This receives the generated episode file.
-
generateSchema
Description copied from class:JAXBRIContext
Generates the schema documents from the model.The caller can use the additionalElementDecls parameter to add element declarations to the generate schema. For example, if the JAX-RPC passes in the following entry:
{foo}bar -> DeclaredType for java.lang.String
then JAXB generates the following element declaration (in the schema document for the namespace "foo")"<xs:element name="bar" type="xs:string" />
This can be used for generating schema components necessary for WSDL.- Specified by:
generateSchema
in classJAXBRIContext
- Parameters:
outputResolver
- this object controls the output to which schemas will be sent.- Throws:
IOException
- ifSchemaOutputResolver
throws anIOException
.
-
getTypeName
Description copied from class:JAXBRIContext
Returns the name of the XML Type bound to the specified Java type.- Specified by:
getTypeName
in classJAXBRIContext
- Parameters:
tr
- must not be null. This must be one of theTypeReference
s specified in theJAXBRIContext.newInstance(java.lang.Class[], java.util.Collection<com.sun.xml.bind.api.TypeReference>, java.util.Map<java.lang.Class, java.lang.Class>, java.lang.String, boolean, com.sun.xml.bind.v2.model.annotation.RuntimeAnnotationReader)
method.- Returns:
- null if the referenced type is an anonymous and therefore doesn't have a name.
-
createBinder
- Overrides:
createBinder
in classjavax.xml.bind.JAXBContext
-
createBinder
- Overrides:
createBinder
in classjavax.xml.bind.JAXBContext
-
getElementName
Description copied from class:JAXBRIContext
If the given object is bound to an element in XML by JAXB, returns the element name.- Specified by:
getElementName
in classJAXBRIContext
- Returns:
- null if the object is not bound to an element.
- Throws:
javax.xml.bind.JAXBException
- if the object is not known to this context.
-
getElementName
Description copied from class:JAXBRIContext
Allows to retrieve the element name based on Class.- Specified by:
getElementName
in classJAXBRIContext
- Returns:
- Throws:
javax.xml.bind.JAXBException
-
createBridge
Description copied from class:JAXBRIContext
Creates a mini-marshaller/unmarshaller that can process aTypeReference
.- Specified by:
createBridge
in classJAXBRIContext
- Returns:
- null if the specified reference is not given to
JAXBRIContext.newInstance(java.lang.Class[], java.util.Collection<com.sun.xml.bind.api.TypeReference>, java.util.Map<java.lang.Class, java.lang.Class>, java.lang.String, boolean, com.sun.xml.bind.v2.model.annotation.RuntimeAnnotationReader)
.
-
createBridgeContext
Description copied from class:JAXBRIContext
Creates a newBridgeContext
instance.- Specified by:
createBridgeContext
in classJAXBRIContext
- Returns:
- always a valid non-null instance.
-
getElementPropertyAccessor
public RawAccessor getElementPropertyAccessor(Class wrapperBean, String nsUri, String localName) throws javax.xml.bind.JAXBException Description copied from class:JAXBRIContext
Gets aRawAccessor
for the specified element property of the specified wrapper bean class.This method is designed to assist the JAX-RPC RI fill in a wrapper bean (in the doc/lit/wrap mode.) In the said mode, a wrapper bean is supposed to only have properties that match elements, and for each element that appear in the content model there's one property.
Therefore, this method takes a wrapper bean and a tag name that identifies a property on the given wrapper bean, then returns a
RawAccessor
that allows the caller to set/get a value from the property of the bean.This method is not designed for a performance. The caller is expected to cache the result.
- Specified by:
getElementPropertyAccessor
in classJAXBRIContext
- Returns:
- always return non-null valid accessor object.
- Throws:
javax.xml.bind.JAXBException
- if the specified wrapper bean is not bound by JAXB, or if it doesn't have an element property of the given name.
-
getKnownNamespaceURIs
Description copied from class:JAXBRIContext
Gets the namespace URIs statically known to thisJAXBContext
.When JAXB is used to marshal into sub-trees, it declares these namespace URIs at each top-level element that it marshals. To avoid repeated namespace declarations at sub-elements, the application may declare those namespaces at a higher level.
- Specified by:
getKnownNamespaceURIs
in classJAXBRIContext
- Returns:
- always non-null.
-
getBuildId
Description copied from class:JAXBRIContext
Gets the build information of the JAXB runtime.- Specified by:
getBuildId
in classJAXBRIContext
- Returns:
- may be null, if the runtime is loaded by a class loader that doesn't support the access to the manifest informatino.
-
toString
-
getXMIMEContentType
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. -
createAugmented
Creates aJAXBContextImpl
that includes the specified additional classes.- Throws:
javax.xml.bind.JAXBException
-