com.sun.xml.bind.api
Class Bridge<T>

java.lang.Object
  extended by com.sun.xml.bind.api.Bridge<T>
Direct Known Subclasses:
BridgeAdapter, BridgeImpl

public abstract class Bridge<T>
extends java.lang.Object

Mini-marshaller/unmarshaller that is specialized for a particular element name and a type.

Instances of this class is stateless and multi-thread safe. They are reentrant.

Every marshalling/unmarshalling operation requires a BridgeContext, and a

Subject to change without notice.

Since:
JAXB 2.0 EA1

Constructor Summary
protected Bridge()
           
 
Method Summary
abstract  TypeReference getTypeReference()
          Gets the TypeReference from which this bridge was created.
abstract  void marshal(BridgeContext context, T object, org.w3c.dom.Node output)
           
abstract  void marshal(BridgeContext context, T object, java.io.OutputStream output, javax.xml.namespace.NamespaceContext nsContext)
          Marshals the specified type object with the implicit element name associated with this instance of Bridge.
abstract  void marshal(BridgeContext context, T object, javax.xml.stream.XMLStreamWriter output)
           
abstract  T unmarshal(BridgeContext context, java.io.InputStream in)
          Unmarshals the specified type object.
abstract  T unmarshal(BridgeContext context, javax.xml.transform.Source in)
          Unmarshals the specified type object.
abstract  T unmarshal(BridgeContext context, javax.xml.stream.XMLStreamReader in)
          Unmarshals the specified type object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Bridge

protected Bridge()
Method Detail

marshal

public abstract void marshal(BridgeContext context,
                             T object,
                             javax.xml.stream.XMLStreamWriter output)
                      throws javax.xml.bind.JAXBException
Throws:
javax.xml.bind.JAXBException - if there was an error while marshalling.
Since:
2.0 EA1

marshal

public abstract void marshal(BridgeContext context,
                             T object,
                             java.io.OutputStream output,
                             javax.xml.namespace.NamespaceContext nsContext)
                      throws javax.xml.bind.JAXBException
Marshals the specified type object with the implicit element name associated with this instance of Bridge.

Parameters:
nsContext - if this marshalling is done to marshal a subelement, this NamespaceContext represents in-scope namespace bindings available for that element. Can be null, in which case JAXB assumes no in-scope namespaces.
Throws:
javax.xml.bind.JAXBException - if there was an error while marshalling.
Since:
2.0 EA1

marshal

public abstract void marshal(BridgeContext context,
                             T object,
                             org.w3c.dom.Node output)
                      throws javax.xml.bind.JAXBException
Throws:
javax.xml.bind.JAXBException

unmarshal

public abstract T unmarshal(BridgeContext context,
                            javax.xml.stream.XMLStreamReader in)
                     throws javax.xml.bind.JAXBException
Unmarshals the specified type object.

Parameters:
in - the parser must be pointing at a start tag that encloses the XML type that this Bridge is instanciated for.
Returns:
never null.
Throws:
javax.xml.bind.JAXBException - if there was an error while unmarshalling.
Since:
2.0 EA1

unmarshal

public abstract T unmarshal(BridgeContext context,
                            javax.xml.transform.Source in)
                     throws javax.xml.bind.JAXBException
Unmarshals the specified type object.

Parameters:
in - the parser must be pointing at a start tag that encloses the XML type that this Bridge is instanciated for.
Returns:
never null.
Throws:
javax.xml.bind.JAXBException - if there was an error while unmarshalling.
Since:
2.0 EA1

unmarshal

public abstract T unmarshal(BridgeContext context,
                            java.io.InputStream in)
                     throws javax.xml.bind.JAXBException
Unmarshals the specified type object.

Parameters:
in - the parser must be pointing at a start tag that encloses the XML type that this Bridge is instanciated for.
Returns:
never null.
Throws:
javax.xml.bind.JAXBException - if there was an error while unmarshalling.
Since:
2.0 EA1

getTypeReference

public abstract TypeReference getTypeReference()
Gets the TypeReference from which this bridge was created.