Skip navigation links

Oracle® WebCenter Content Site Studio for External Applications Java API Reference
11g Release 1 (11.1.1)

E17273-03


oracle.stellent.wcm.common.xml
Class JAXBSerializer<T>

java.lang.Object
  extended by oracle.stellent.wcm.common.xml.JAXBSerializer<T>

Direct Known Subclasses:
JAXBConfigurationSerializer, JAXBConversionsDefinitionSerializer, JAXBDataFileSerializer, JAXBElementDefinitionSerializer, JAXBPlaceholderDefinitionSerializer, JAXBProjectFileSerializer, JAXBRegionDefinitionSerializer

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

Base class for marshalling/unmarshalling data using the JAXB framework. It is meant to follow a similiar paradigm to the oracle.stellent.wcm.common.xml.AbstractXmlSerializer class.


Constructor Summary
JAXBSerializer()
           

 

Method Summary
protected abstract  javax.xml.bind.JAXBElement coerceFromType(T object)
          Coerce the input type into a type that can be marshalled.
protected abstract  T coerceToType(javax.xml.bind.JAXBElement unmarshalledObject)
          Coerce the unmarshalled object into the type to return
protected abstract  javax.xml.bind.JAXBContext createJAXBContext()
          Create the JAXBContext object.
protected  javax.xml.bind.Marshaller createMarshaller()
          Create the marshaller from the current jaxb context
protected  javax.xml.bind.Unmarshaller createUnmarshaller()
          Create the unmarshaller from the current context
 javax.xml.bind.JAXBContext getContext()
          The current context; if not set, a call is made to createJAXBContext().
protected  java.lang.String getLocalSchemaLocation()
           
 javax.xml.validation.Schema getSchema()
           
protected  java.lang.String getSchemaLocation()
           
 T readObject(java.io.InputStream inputStream)
          Deserialize the object from the given XML InputStream
 T readObject(java.io.Reader reader)
          Deserialize the object from the given XML InputStream
 void writeObject(T object, java.io.OutputStream outputStream)
          Serializes the object to the given OutputStream in XML format.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

JAXBSerializer

public JAXBSerializer()

Method Detail

getContext

public javax.xml.bind.JAXBContext getContext()
                                      throws javax.xml.bind.JAXBException
The current context; if not set, a call is made to createJAXBContext().
Returns:
the active context
Throws:
javax.xml.bind.JAXBException

getSchema

public javax.xml.validation.Schema getSchema()
                                      throws org.xml.sax.SAXException
Returns:
the schema to use for this parser
Throws:
org.xml.sax.SAXException

writeObject

public void writeObject(T object,
                        java.io.OutputStream outputStream)
                 throws javax.xml.bind.JAXBException
Serializes the object to the given OutputStream in XML format.
Parameters:
object - the object to serialize
outputStream - the outputstream to write the XML
Throws:
javax.xml.bind.JAXBException - if an serialization error occurs

readObject

public T readObject(java.io.InputStream inputStream)
             throws javax.xml.bind.JAXBException
Deserialize the object from the given XML InputStream
Parameters:
inputStream - the inputstream of XML content
Returns:
the constructed object
Throws:
javax.xml.bind.JAXBException - if an serialization error occurs

readObject

public T readObject(java.io.Reader reader)
             throws javax.xml.bind.JAXBException
Deserialize the object from the given XML InputStream
Parameters:
reader - the Reader of XML content
Returns:
the constructed object
Throws:
javax.xml.bind.JAXBException - if an serialization error occurs

createJAXBContext

protected abstract javax.xml.bind.JAXBContext createJAXBContext()
                                                         throws javax.xml.bind.JAXBException
Create the JAXBContext object. Note: this is only called once and the result is cached
Returns:
the JAXBContext
Throws:
javax.xml.bind.JAXBException

createUnmarshaller

protected javax.xml.bind.Unmarshaller createUnmarshaller()
                                                  throws javax.xml.bind.JAXBException
Create the unmarshaller from the current context
Returns:
the unmarshaller
Throws:
javax.xml.bind.JAXBException

createMarshaller

protected javax.xml.bind.Marshaller createMarshaller()
                                              throws javax.xml.bind.JAXBException
Create the marshaller from the current jaxb context
Returns:
the marshaller
Throws:
javax.xml.bind.JAXBException

getLocalSchemaLocation

protected java.lang.String getLocalSchemaLocation()
Returns:
the local schema location or null to not use schema validation

coerceToType

protected abstract T coerceToType(javax.xml.bind.JAXBElement unmarshalledObject)
Coerce the unmarshalled object into the type to return
Parameters:
unmarshalledObject - the unmarshalled jaxb object
Returns:
the converted type

coerceFromType

protected abstract javax.xml.bind.JAXBElement coerceFromType(T object)
Coerce the input type into a type that can be marshalled.
Parameters:
object - the input object
Returns:
an object to be handed to the jaxb library

getSchemaLocation

protected java.lang.String getSchemaLocation()
Returns:
the schema location or null for no location

Skip navigation links

Oracle® WebCenter Content Site Studio for External Applications Java API Reference
11g Release 1 (11.1.1)

E17273-03


Copyright © 2010, 2011, Oracle and/or its affiliates. All rights reserved.