com.sun.xml.ws.spi.db
Interface BindingContext


public interface BindingContext

JAXBContext enhanced with JAXB RI specific functionalities.

Subject to change without notice.

Since:
2.0 EA1

Field Summary
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 ENABLE_XOP
          Marshaller/Unmarshaller property to enable XOP processing.
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 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.
 
Method Summary
 XMLBridge createBridge(TypeInfo ref)
          Creates a mini-marshaller/unmarshaller that can process a TypeInfo.
 XMLBridge createFragmentBridge()
           
 javax.xml.bind.Marshaller createMarshaller()
           
 javax.xml.bind.Unmarshaller createUnmarshaller()
           
 void generateSchema(javax.xml.bind.SchemaOutputResolver outputResolver)
          Generates the schema documents from the model.
 java.lang.String getBuildId()
          Gets the build information of the JAXB runtime.
 javax.xml.namespace.QName getElementName(java.lang.Class o)
          Allows to retrieve the element name based on Class.
 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.
<B,V> PropertyAccessor<B,V>
getElementPropertyAccessor(java.lang.Class<B> wrapperBean, java.lang.String nsUri, java.lang.String localName)
          Gets a PropertyAccessor for the specified element property of the specified wrapper bean class.
 javax.xml.bind.JAXBContext getJAXBContext()
           
 java.util.List<java.lang.String> getKnownNamespaceURIs()
          Gets the namespace URIs statically known to this JAXBContext.
 javax.xml.namespace.QName getTypeName(TypeInfo tr)
          Returns the name of the XML Type bound to the specified Java type.
 boolean hasSwaRef()
          Returns true if this context includes a class that has XmlAttachmentRef.
 java.lang.Object newWrapperInstace(java.lang.Class<?> wrapperType)
           
 

Field Detail

DEFAULT_NAMESPACE_REMAP

static final 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.

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:
Constant Field Values

TYPE_REFERENCES

static final 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.

The value of the property is Collection<TypeInfo>. Those TypeInfos can then be used to create XMLBridges.

This mechanism allows additional element declarations that were not a part of the schema into the created JAXBContext.

Since:
2.0 EA1
See Also:
Constant Field Values

CANONICALIZATION_SUPPORT

static final 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.

Since:
2.0 EA2
See Also:
C14nSupport_ArchitectureDocument, Constant Field Values

TREAT_EVERYTHING_NILLABLE

static final 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.

Since:
2.1.3
See Also:
Constant Field Values

ENABLE_XOP

static final java.lang.String ENABLE_XOP
Marshaller/Unmarshaller property to enable XOP processing.

Since:
2.0 EA2
See Also:
Constant Field Values

SUBCLASS_REPLACEMENTS

static final 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.

See the release notes for more details about this feature.

Since:
2.1 EA2
See Also:
Constant Field Values

XMLACCESSORFACTORY_SUPPORT

static final 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.

Since:
2.1 EA2
See Also:
Constant Field Values

RETAIN_REFERENCE_TO_INFO

static final java.lang.String RETAIN_REFERENCE_TO_INFO
Retains references to PropertyInfos.

Since:
2.1.10
See Also:
Constant Field Values
Method Detail

createMarshaller

javax.xml.bind.Marshaller createMarshaller()
                                           throws javax.xml.bind.JAXBException
Throws:
javax.xml.bind.JAXBException

createUnmarshaller

javax.xml.bind.Unmarshaller createUnmarshaller()
                                               throws javax.xml.bind.JAXBException
Throws:
javax.xml.bind.JAXBException

getJAXBContext

javax.xml.bind.JAXBContext getJAXBContext()

newWrapperInstace

java.lang.Object newWrapperInstace(java.lang.Class<?> wrapperType)
                                   throws java.lang.InstantiationException,
                                          java.lang.IllegalAccessException
Throws:
java.lang.InstantiationException
java.lang.IllegalAccessException

hasSwaRef

boolean hasSwaRef()
Returns true if this context includes a class that has XmlAttachmentRef.

Since:
2.1

getElementName

@Nullable
javax.xml.namespace.QName getElementName(@NotNull
                                                  java.lang.Object o)
                                         throws javax.xml.bind.JAXBException
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:
javax.xml.bind.JAXBException - if the object is not known to this context.
Since:
2.0 EA1

getElementName

@Nullable
javax.xml.namespace.QName getElementName(@NotNull
                                                  java.lang.Class o)
                                         throws javax.xml.bind.JAXBException
Allows to retrieve the element name based on Class.

Parameters:
o -
Returns:
Throws:
javax.xml.bind.JAXBException
Since:
2.1.10

createBridge

XMLBridge createBridge(@NotNull
                       TypeInfo ref)
Creates a mini-marshaller/unmarshaller that can process a TypeInfo.

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(java.lang.Class<B> wrapperBean,
                                                       java.lang.String nsUri,
                                                       java.lang.String localName)
                                                 throws javax.xml.bind.JAXBException
Gets a PropertyAccessor 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 PropertyAccessor 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.

Type Parameters:
B - type of the wrapper bean
V - type of the property of the bean
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.
Since:
2.0 EA1

getKnownNamespaceURIs

@NotNull
java.util.List<java.lang.String> getKnownNamespaceURIs()
Gets the namespace URIs statically known to this 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.

Returns:
always non-null.
Since:
2.0 EA2

generateSchema

void generateSchema(@NotNull
                    javax.xml.bind.SchemaOutputResolver outputResolver)
                    throws java.io.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:
java.io.IOException - if SchemaOutputResolver throws an IOException.

getTypeName

javax.xml.namespace.QName getTypeName(@NotNull
                                      TypeInfo tr)
Returns the name of the XML Type bound to the specified Java type.

Parameters:
tr - must not be null. This must be one of the TypeInfos specified in the BindingContext#newInstance method.
Returns:
null if the referenced type is an anonymous and therefore doesn't have a name.
Throws:
java.lang.IllegalArgumentException - if the parameter is null or not a part of the TypeInfos specified in the newWrapperInstace(Class) method.

getBuildId

@NotNull
java.lang.String 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.


Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved.