JAXBContextImpl
public abstract class JAXBRIContext
extends javax.xml.bind.JAXBContext
JAXBContext
enhanced with JAXB RI specific functionalities.
Subject to change without notice.
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
ANNOTATION_READER |
The property that you can specify to
JAXBContext.newInstance(java.lang.String)
to use alternative RuntimeAnnotationReader implementation. |
static java.lang.String |
BACKUP_WITH_PARENT_NAMESPACE |
If true and element namespace is not specified, namespace of parent element will be used.
|
static java.lang.String |
CANONICALIZATION_SUPPORT |
The property that you can specify to
JAXBContext.newInstance(java.lang.String)
and Marshaller.setProperty(String, Object)
to enable the c14n marshalling support in the JAXBContext . |
static java.lang.String |
DEFAULT_NAMESPACE_REMAP |
The property that you can specify to
JAXBContext.newInstance(java.lang.String)
to reassign the default namespace URI to something else at the runtime. |
static java.lang.String |
DISABLE_XML_SECURITY |
If true XML security features when parsing XML documents will be disabled.
|
static java.lang.String |
ENABLE_XOP |
Marshaller/Unmarshaller property to enable XOP processing.
|
static java.lang.String |
IMPROVED_XSI_TYPE_HANDLING |
Improves handling of xsi:type used on leaf properties.
|
static java.lang.String |
RETAIN_REFERENCE_TO_INFO |
Retains references to PropertyInfos.
|
static java.lang.String |
SUBCLASS_REPLACEMENTS |
The property that you can specify to
JAXBContext.newInstance(java.lang.String)
to specify specific classes that replace the reference to generic classes. |
static java.lang.String |
SUPRESS_ACCESSOR_WARNINGS |
Supress security warnings when trying to access fields through reflection.
|
static java.lang.String |
TREAT_EVERYTHING_NILLABLE |
The property that you can specify to
JAXBContext.newInstance(java.lang.String)
to allow unmarshaller to honor xsi:nil anywhere, even if they are
not specifically allowed by the schema. |
static java.lang.String |
TYPE_REFERENCES |
The property that you can specify to
JAXBContext.newInstance(java.lang.String)
to put additional JAXB type references into the JAXBContext . |
static java.lang.String |
XMLACCESSORFACTORY_SUPPORT |
The property that you can specify to
JAXBContext.newInstance(java.lang.String)
enable support of XmlAccessorFactory annotation in the JAXBContext . |
Modifier | Constructor | Description |
---|---|---|
protected |
JAXBRIContext() |
Modifier and Type | Method | Description |
---|---|---|
abstract Bridge |
createBridge(TypeReference ref) |
Creates a mini-marshaller/unmarshaller that can process a
TypeReference . |
abstract BridgeContext |
createBridgeContext() |
Creates a new
BridgeContext instance. |
abstract void |
generateEpisode(javax.xml.transform.Result output) |
Generates the episode file that represents the binding known to this
JAXBContext ,
so that XJC can later do separate compilation. |
abstract void |
generateSchema(javax.xml.bind.SchemaOutputResolver outputResolver) |
Generates the schema documents from the model.
|
static java.lang.reflect.Type |
getBaseType(java.lang.reflect.Type type,
java.lang.Class baseType) |
Gets the parameterization of the given base type.
|
abstract java.lang.String |
getBuildId() |
Gets the build information of the JAXB runtime.
|
abstract javax.xml.namespace.QName |
getElementName(java.lang.Class o) |
Allows to retrieve the element name based on Class.
|
abstract javax.xml.namespace.QName |
getElementName(java.lang.Object o) |
If the given object is bound to an element in XML by JAXB,
returns the element name.
|
abstract <B,V> RawAccessor<B,V> |
getElementPropertyAccessor(java.lang.Class<B> wrapperBean,
java.lang.String nsUri,
java.lang.String localName) |
Gets a
RawAccessor for the specified element property of the specified wrapper bean class. |
abstract java.util.List<java.lang.String> |
getKnownNamespaceURIs() |
Gets the namespace URIs statically known to this
JAXBContext . |
abstract RuntimeTypeInfoSet |
getRuntimeTypeInfoSet() |
Allows you to access the runtime model information of the JAXB XML/Java binding.
|
abstract javax.xml.namespace.QName |
getTypeName(TypeReference tr) |
Returns the name of the XML Type bound to the
specified Java type.
|
abstract boolean |
hasSwaRef() |
Returns true if this context includes a class
that has
XmlAttachmentRef . |
static java.lang.String |
mangleNameToClassName(java.lang.String localName) |
Computes a Java class name from a local name.
|
static java.lang.String |
mangleNameToPropertyName(java.lang.String localName) |
Computes a Java class name from a local name.
|
static java.lang.String |
mangleNameToVariableName(java.lang.String localName) |
Computes a Java identifier from a local name.
|
static JAXBRIContext |
newInstance(java.lang.Class[] classes,
java.util.Collection<TypeReference> typeRefs,
java.lang.String defaultNamespaceRemap,
boolean c14nSupport) |
Deprecated.
Compatibility with older versions.
|
static JAXBRIContext |
newInstance(java.lang.Class[] classes,
java.util.Collection<TypeReference> typeRefs,
java.util.Map<java.lang.Class,java.lang.Class> subclassReplacements,
java.lang.String defaultNamespaceRemap,
boolean c14nSupport,
RuntimeAnnotationReader ar) |
Creates a new
JAXBRIContext . |
static JAXBRIContext |
newInstance(java.lang.Class[] classes,
java.util.Collection<TypeReference> typeRefs,
java.util.Map<java.lang.Class,java.lang.Class> subclassReplacements,
java.lang.String defaultNamespaceRemap,
boolean c14nSupport,
RuntimeAnnotationReader ar,
boolean xmlAccessorFactorySupport,
boolean allNillable,
boolean retainPropertyInfo,
boolean supressAccessorWarnings) |
Creates a new
JAXBRIContext . |
public static final java.lang.String DEFAULT_NAMESPACE_REMAP
JAXBContext.newInstance(java.lang.String)
to reassign the default namespace URI to something else at the runtime.
The value of the property is String
, and it is used as the namespace URI
that succeeds the default namespace URI.
public static final java.lang.String TYPE_REFERENCES
JAXBContext.newInstance(java.lang.String)
to put additional JAXB type references into the JAXBContext
.
The value of the property is Collection
<
TypeReference
>
.
Those TypeReference
s can then be used to create Bridge
s.
This mechanism allows additional element declarations that were not a part of
the schema into the created JAXBContext
.
public static final java.lang.String CANONICALIZATION_SUPPORT
JAXBContext.newInstance(java.lang.String)
and Marshaller.setProperty(String, Object)
to enable the c14n marshalling support in the JAXBContext
.
Booleanpublic static final java.lang.String TREAT_EVERYTHING_NILLABLE
JAXBContext.newInstance(java.lang.String)
to allow unmarshaller to honor xsi:nil
anywhere, even if they are
not specifically allowed by the schema.
Booleanpublic static final java.lang.String ANNOTATION_READER
JAXBContext.newInstance(java.lang.String)
to use alternative RuntimeAnnotationReader
implementation.public static final java.lang.String ENABLE_XOP
public static final java.lang.String SUBCLASS_REPLACEMENTS
JAXBContext.newInstance(java.lang.String)
to specify specific classes that replace the reference to generic classes.
See the release notes for more details about this feature.
public static final java.lang.String XMLACCESSORFACTORY_SUPPORT
JAXBContext.newInstance(java.lang.String)
enable support of XmlAccessorFactory annotation in the JAXBContext
.public static final java.lang.String RETAIN_REFERENCE_TO_INFO
public static final java.lang.String SUPRESS_ACCESSOR_WARNINGS
public static final java.lang.String IMPROVED_XSI_TYPE_HANDLING
public static final java.lang.String DISABLE_XML_SECURITY
public static final java.lang.String BACKUP_WITH_PARENT_NAMESPACE
public static JAXBRIContext newInstance(@NotNull java.lang.Class[] classes, @Nullable java.util.Collection<TypeReference> typeRefs, @Nullable java.util.Map<java.lang.Class,java.lang.Class> subclassReplacements, @Nullable java.lang.String defaultNamespaceRemap, boolean c14nSupport, @Nullable RuntimeAnnotationReader ar) throws javax.xml.bind.JAXBException
JAXBRIContext
.
JAXBContext.newInstance()
methods may
return other JAXB providers that are not compatible with the JAX-RPC RI.
This method guarantees that the JAX-WS RI will finds the JAXB RI.
classes
- Classes to be bound. See JAXBContext.newInstance(Class[])
for the meaning.typeRefs
- See TYPE_REFERENCES
for the meaning of this parameter.
Can be null.subclassReplacements
- See SUBCLASS_REPLACEMENTS
for the meaning of this parameter.
Can be null.defaultNamespaceRemap
- See DEFAULT_NAMESPACE_REMAP
for the meaning of this parameter.
Can be null (and should be null for ordinary use of JAXB.)c14nSupport
- See CANONICALIZATION_SUPPORT
for the meaning of this parameter.ar
- See ANNOTATION_READER
for the meaning of this parameter.
Can be null.javax.xml.bind.JAXBException
public static JAXBRIContext newInstance(@NotNull java.lang.Class[] classes, @Nullable java.util.Collection<TypeReference> typeRefs, @Nullable java.util.Map<java.lang.Class,java.lang.Class> subclassReplacements, @Nullable java.lang.String defaultNamespaceRemap, boolean c14nSupport, @Nullable RuntimeAnnotationReader ar, boolean xmlAccessorFactorySupport, boolean allNillable, boolean retainPropertyInfo, boolean supressAccessorWarnings) throws javax.xml.bind.JAXBException
JAXBRIContext
.
JAXBContext.newInstance()
methods may
return other JAXB providers that are not compatible with the JAX-RPC RI.
This method guarantees that the JAX-WS RI will finds the JAXB RI.
classes
- Classes to be bound. See JAXBContext.newInstance(Class[])
for the meaning.typeRefs
- See TYPE_REFERENCES
for the meaning of this parameter.
Can be null.subclassReplacements
- See SUBCLASS_REPLACEMENTS
for the meaning of this parameter.
Can be null.defaultNamespaceRemap
- See DEFAULT_NAMESPACE_REMAP
for the meaning of this parameter.
Can be null (and should be null for ordinary use of JAXB.)c14nSupport
- See CANONICALIZATION_SUPPORT
for the meaning of this parameter.ar
- See ANNOTATION_READER
for the meaning of this parameter.
Can be null.xmlAccessorFactorySupport
- See XMLACCESSORFACTORY_SUPPORT
for the meaning of this parameter.allNillable
- See TREAT_EVERYTHING_NILLABLE
for the meaning of this parameter.retainPropertyInfo
- See RETAIN_REFERENCE_TO_INFO
for the meaning of this parameter.supressAccessorWarnings
- See SUPRESS_ACCESSOR_WARNINGS
for the meaning of this parameter.javax.xml.bind.JAXBException
public static JAXBRIContext newInstance(@NotNull java.lang.Class[] classes, @Nullable java.util.Collection<TypeReference> typeRefs, @Nullable java.lang.String defaultNamespaceRemap, boolean c14nSupport) throws javax.xml.bind.JAXBException
javax.xml.bind.JAXBException
public abstract boolean hasSwaRef()
XmlAttachmentRef
.@Nullable public abstract javax.xml.namespace.QName getElementName(@NotNull java.lang.Object o) throws javax.xml.bind.JAXBException
javax.xml.bind.JAXBException
- if the object is not known to this context.@Nullable public abstract javax.xml.namespace.QName getElementName(@NotNull java.lang.Class o) throws javax.xml.bind.JAXBException
o
- javax.xml.bind.JAXBException
public abstract Bridge createBridge(@NotNull TypeReference ref)
TypeReference
.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)
.@NotNull public abstract BridgeContext createBridgeContext()
BridgeContext
instance.public abstract <B,V> RawAccessor<B,V> getElementPropertyAccessor(java.lang.Class<B> wrapperBean, java.lang.String nsUri, java.lang.String localName) throws javax.xml.bind.JAXBException
RawAccessor
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.
B
- type of the wrapper beanV
- type of the property of the beanjavax.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.@NotNull public abstract java.util.List<java.lang.String> getKnownNamespaceURIs()
JAXBContext
.
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.
public abstract void generateSchema(@NotNull javax.xml.bind.SchemaOutputResolver outputResolver) throws java.io.IOException
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.
generateSchema
in class javax.xml.bind.JAXBContext
outputResolver
- this object controls the output to which schemas
will be sent.java.io.IOException
- if SchemaOutputResolver
throws an IOException
.public abstract javax.xml.namespace.QName getTypeName(@NotNull TypeReference tr)
tr
- must not be null. This must be one of the TypeReference
s specified
in the 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.java.lang.IllegalArgumentException
- if the parameter is null or not a part of the TypeReference
s specified
in the 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.@NotNull public abstract java.lang.String getBuildId()
public abstract void generateEpisode(javax.xml.transform.Result output)
JAXBContext
,
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.
output
- This receives the generated episode file.public abstract RuntimeTypeInfoSet getRuntimeTypeInfoSet()
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/
@NotNull public static java.lang.String mangleNameToVariableName(@NotNull java.lang.String localName)
This method faithfully implements the name mangling rule as specified in the JAXB spec.
In JAXB, a collision with a Java reserved word (such as "return") never happens. Accordingly, this method may return an identifier that collides with reserved words.
Use JJavaName.isJavaIdentifier(String)
to check for such collision.
@NotNull public static java.lang.String mangleNameToClassName(@NotNull java.lang.String localName)
This method faithfully implements the name mangling rule as specified in the JAXB spec.
@NotNull public static java.lang.String mangleNameToPropertyName(@NotNull java.lang.String localName)
This method faithfully implements the name mangling rule as specified in the JAXB spec.
This method works like mangleNameToClassName(String)
except that it looks
for "getClass" and returns something else.
@Nullable public static java.lang.reflect.Type getBaseType(@NotNull java.lang.reflect.Type type, @NotNull java.lang.Class baseType)
For example, given the following
interface Foo<T> extends List<List<T>> {}
interface Bar extends Foo<String> {}
This method works like this:
getBaseClass( Bar, List ) = List<List<String>
getBaseClass( Bar, Foo ) = Foo<String>
getBaseClass( Foo<? extends Number>, Collection ) = Collection<List<? extends Number>>
getBaseClass( ArrayList<? extends BigInteger>, List ) = List<? extends BigInteger>
type
- The type that derives from baseType
baseType
- The class whose parameterization we are interested in.baseType
in type
.
or null if the type is not assignable to the base type.Copyright © 2018 Oracle Corporation. All rights reserved.