Interface BindingContext
JAXBContext enhanced with JAXB RI specific functionalities.
Subject to change without notice.
- Since:
- 2.0 EA1
- Author:
- Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com), shih-chang.chen@oracle.com
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe property that you can specify toJAXBContext.newInstance(java.lang.String)andMarshaller.setProperty(String, Object)to enable the c14n marshalling support in theJAXBContext.static final StringThe property that you can specify toJAXBContext.newInstance(java.lang.String)to reassign the default namespace URI to something else at the runtime.static final StringMarshaller/Unmarshaller property to enable XOP processing.static final StringRetains references to PropertyInfos.static final StringThe property that you can specify toJAXBContext.newInstance(java.lang.String)to specify specific classes that replace the reference to generic classes.static final StringThe property that you can specify toJAXBContext.newInstance(java.lang.String)to allow unmarshaller to honorxsi:nilanywhere, even if they are not specifically allowed by the schema.static final StringThe property that you can specify toJAXBContext.newInstance(java.lang.String)to put additional JAXB type references into theJAXBContext.static final StringThe property that you can specify toJAXBContext.newInstance(java.lang.String)enable support of XmlAccessorFactory annotation in theJAXBContext. -
Method Summary
Modifier and TypeMethodDescriptioncreateBridge(TypeInfo ref) Creates a mini-marshaller/unmarshaller that can process aTypeInfo.jakarta.xml.bind.Marshallerjakarta.xml.bind.UnmarshallervoidgenerateSchema(jakarta.xml.bind.SchemaOutputResolver outputResolver) Generates the schema documents from the model.Gets the build information of the JAXB runtime.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.<B,V> PropertyAccessor<B, V> getElementPropertyAccessor(Class<B> wrapperBean, String nsUri, String localName) Gets aPropertyAccessorfor the specified element property of the specified wrapper bean class.jakarta.xml.bind.JAXBContextGets the namespace URIs statically known to thisJAXBContext.getTypeName(TypeInfo tr) Returns the name of the XML Type bound to the specified Java type.booleanReturns true if this context includes a class that hasXmlAttachmentRef.newWrapperInstace(Class<?> wrapperType)
-
Field Details
-
DEFAULT_NAMESPACE_REMAP
The property that you can specify toJAXBContext.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.- Since:
- 2.0 EA1
- See Also:
-
TYPE_REFERENCES
The property that you can specify toJAXBContext.newInstance(java.lang.String)to put additional JAXB type references into theJAXBContext.The value of the property is
Collection<TypeInfo>. ThoseTypeInfos can then be used to createXMLBridges.This mechanism allows additional element declarations that were not a part of the schema into the created
JAXBContext.- Since:
- 2.0 EA1
- See Also:
-
CANONICALIZATION_SUPPORT
The property that you can specify toJAXBContext.newInstance(java.lang.String)andMarshaller.setProperty(String, Object)to enable the c14n marshalling support in theJAXBContext.- Since:
- 2.0 EA2
- See Also:
-
TREAT_EVERYTHING_NILLABLE
The property that you can specify toJAXBContext.newInstance(java.lang.String)to allow unmarshaller to honorxsi:nilanywhere, even if they are not specifically allowed by the schema.- Since:
- 2.1.3
- See Also:
-
ENABLE_XOP
Marshaller/Unmarshaller property to enable XOP processing.- Since:
- 2.0 EA2
- See Also:
-
SUBCLASS_REPLACEMENTS
The property that you can specify toJAXBContext.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.
- Since:
- 2.1 EA2
- See Also:
-
XMLACCESSORFACTORY_SUPPORT
The property that you can specify toJAXBContext.newInstance(java.lang.String)enable support of XmlAccessorFactory annotation in theJAXBContext.- Since:
- 2.1 EA2
- See Also:
-
RETAIN_REFERENCE_TO_INFO
Retains references to PropertyInfos.- Since:
- 2.1.10
- See Also:
-
-
Method Details
-
createMarshaller
jakarta.xml.bind.Marshaller createMarshaller() throws jakarta.xml.bind.JAXBException- Throws:
jakarta.xml.bind.JAXBException
-
createUnmarshaller
jakarta.xml.bind.Unmarshaller createUnmarshaller() throws jakarta.xml.bind.JAXBException- Throws:
jakarta.xml.bind.JAXBException
-
getJAXBContext
jakarta.xml.bind.JAXBContext getJAXBContext() -
newWrapperInstace
Object newWrapperInstace(Class<?> wrapperType) throws InstantiationException, IllegalAccessException -
hasSwaRef
boolean hasSwaRef()Returns true if this context includes a class that hasXmlAttachmentRef.- Since:
- 2.1
-
getElementName
If the given object is bound to an element in XML by JAXB, returns the element name.- Returns:
- null if the object is not bound to an element.
- Throws:
jakarta.xml.bind.JAXBException- if the object is not known to this context.- Since:
- 2.0 EA1
-
getElementName
Allows to retrieve the element name based on Class.- Throws:
jakarta.xml.bind.JAXBException- Since:
- 2.1.10
-
createBridge
Creates a mini-marshaller/unmarshaller that can process aTypeInfo.- Returns:
- null if the specified reference is not given to
newWrapperInstace(Class). - Since:
- 2.0 EA1
-
createFragmentBridge
XMLBridge createFragmentBridge() -
getElementPropertyAccessor
<B,V> PropertyAccessor<B,V> getElementPropertyAccessor(Class<B> wrapperBean, String nsUri, String localName) throws jakarta.xml.bind.JAXBException Gets aPropertyAccessorfor 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
PropertyAccessorthat 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.
- Type Parameters:
B- type of the wrapper beanV- type of the property of the bean- Returns:
- always return non-null valid accessor object.
- Throws:
jakarta.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.- Since:
- 2.0 EA1
-
getKnownNamespaceURIs
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.
- Returns:
- always non-null.
- Since:
- 2.0 EA2
-
generateSchema
void generateSchema(@NotNull jakarta.xml.bind.SchemaOutputResolver outputResolver) throws IOException 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.
- Parameters:
outputResolver- this object controls the output to which schemas will be sent.- Throws:
IOException- ifSchemaOutputResolverthrows anIOException.
-
getTypeName
Returns the name of the XML Type bound to the specified Java type.- Parameters:
tr- must not be null. This must be one of theTypeInfos specified in thenewWrapperInstace(java.lang.Class)method.- Returns:
- null if the referenced type is an anonymous and therefore doesn't have a name.
- Throws:
IllegalArgumentException- if the parameter is null or not a part of theTypeInfos specified in thenewWrapperInstace(Class)method.
-
getBuildId
Gets the build information of the JAXB runtime.- Returns:
- may be null, if the runtime is loaded by a class loader that doesn't support the access to the manifest informatino.
-