|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.restlet.representation.Variant
org.restlet.representation.RepresentationInfo
org.restlet.representation.Representation
org.restlet.representation.CharacterRepresentation
org.restlet.representation.WriterRepresentation
org.restlet.ext.jaxb.JaxbRepresentation<T>
T - The type to wrap.public class JaxbRepresentation<T>
An XML representation based on JAXB that provides easy translation between XML and JAXB element class trees.
| Field Summary |
|---|
| Fields inherited from class org.restlet.representation.Representation |
|---|
UNKNOWN_SIZE |
| Constructor Summary | |
|---|---|
JaxbRepresentation(MediaType mediaType,
T object)
Creates a JAXB representation from an existing JAXB content tree. |
|
JaxbRepresentation(MediaType mediaType,
T object,
ClassLoader classloader)
Creates a JAXB representation from an existing JAXB content tree. |
|
JaxbRepresentation(Representation xmlRepresentation,
Class<T> type)
Creates a new JAXB representation, converting the input XML into a Java content tree. |
|
JaxbRepresentation(Representation xmlRepresentation,
Class<T> type,
ValidationEventHandler validationHandler)
Creates a new JAXB representation, converting the input XML into a Java content tree. |
|
JaxbRepresentation(Representation xmlRepresentation,
String contextPath)
Creates a new JAXB representation, converting the input XML into a Java content tree. |
|
JaxbRepresentation(Representation xmlRepresentation,
String contextPath,
ValidationEventHandler validationHandler)
Creates a new JAXB representation, converting the input XML into a Java content tree. |
|
JaxbRepresentation(Representation xmlRepresentation,
String contextPath,
ValidationEventHandler validationHandler,
ClassLoader classLoader)
Creates a new JAXB representation, converting the input XML into a Java content tree. |
|
JaxbRepresentation(T object)
Creates a JAXB representation from an existing JAXB content tree with MediaType.APPLICATION_XML. |
|
| Method Summary | |
|---|---|
ClassLoader |
getClassLoader()
Returns the classloader to use for JAXB annotated classes. |
JAXBContext |
getContext()
Returns the JAXB context. |
static JAXBContext |
getContext(String contextPath)
Returns the JAXB context, if possible from the cached contexts. |
static JAXBContext |
getContext(String contextPath,
ClassLoader classLoader)
Returns the JAXB context, if possible from the cached contexts. |
String |
getContextPath()
Returns the list of Java package names that contain schema derived class and/or Java to schema (JAXB-annotated) mapped classes |
JAXBSource |
getJaxbSource()
Returns a JAXB SAX source. |
com.sun.xml.bind.marshaller.NamespacePrefixMapper |
getNamespacePrefixMapper()
Returns the optional namespace prefix mapper for marshalling. |
String |
getNoNamespaceSchemaLocation()
Returns the "xsi:noNamespaceSchemaLocation" attribute in the generated XML data. |
T |
getObject()
Returns the wrapped Java object. |
String |
getSchemaLocation()
Returns the "xsi:schemaLocation" attribute in the generated XML data. |
ValidationEventHandler |
getValidationEventHandler()
Returns the optional validation event handler. |
boolean |
isFormattedOutput()
Indicates if the resulting XML data should be formatted with line breaks and indentation. |
boolean |
isFragment()
Indicates whether or not document level events will be generated by the Marshaller. |
void |
setClassLoader(ClassLoader classLoader)
Sets the classloader to use for JAXB annotated classes. |
void |
setContextPath(String contextPath)
Sets the list of Java package names that contain schema derived class and/or Java to schema (JAXB-annotated) mapped classes. |
void |
setFormattedOutput(boolean formattedOutput)
Indicates if the resulting XML data should be formatted with line breaks and indentation. |
void |
setFragment(boolean fragment)
Indicates whether or not document level events will be generated by the Marshaller. |
void |
setNamespacePrefixMapper(com.sun.xml.bind.marshaller.NamespacePrefixMapper namespacePrefixMapper)
Sets the optional namespace prefix mapper for marshalling. |
void |
setNoNamespaceSchemaLocation(String noNamespaceSchemaLocation)
Sets the "xsi:noNamespaceSchemaLocation" attribute in the generated XML data. |
void |
setObject(T object)
Sets the wrapped Java object. |
void |
setSchemaLocation(String schemaLocation)
Sets the "xsi:schemaLocation" attribute in the generated XML data. |
void |
setValidationEventHandler(ValidationEventHandler validationEventHandler)
Sets the validation event handler. |
void |
write(Writer writer)
Writes the representation to a stream of characters. |
| Methods inherited from class org.restlet.representation.WriterRepresentation |
|---|
getReader |
| Methods inherited from class org.restlet.representation.CharacterRepresentation |
|---|
getChannel, getStream, write, write |
| Methods inherited from class org.restlet.representation.Representation |
|---|
append, exhaust, getAvailableSize, getDigest, getDisposition, getExpirationDate, getRange, getRegistration, getSize, getText, hasKnownSize, isAvailable, isEmpty, isSelectable, isTransient, release, setAvailable, setDigest, setDisposition, setExpirationDate, setListener, setRange, setSize, setTransient |
| Methods inherited from class org.restlet.representation.RepresentationInfo |
|---|
getModificationDate, getTag, setModificationDate, setTag |
| Methods inherited from class org.restlet.representation.Variant |
|---|
createClientInfo, equals, getCharacterSet, getEncodings, getLanguages, getLocationRef, getMediaType, includes, isCompatible, setCharacterSet, setEncodings, setLanguages, setLocationRef, setLocationRef, setMediaType, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public JaxbRepresentation(MediaType mediaType,
T object)
mediaType - The representation's media type.object - The Java object.
public JaxbRepresentation(MediaType mediaType,
T object,
ClassLoader classloader)
mediaType - The representation's media type.object - The Java object.classloader - The classloader to use for JAXB annotated classes.
public JaxbRepresentation(Representation xmlRepresentation,
Class<T> type)
xmlRepresentation - The XML wrapped in a representation.type - The type to convert to.
JAXBException - If the incoming XML does not validate against the schema.
IOException - If unmarshalling XML fails.
public JaxbRepresentation(Representation xmlRepresentation,
Class<T> type,
ValidationEventHandler validationHandler)
xmlRepresentation - The XML wrapped in a representation.type - The type to convert to.validationHandler - A handler for dealing with validation failures.
JAXBException - If the incoming XML does not validate against the schema.
IOException - If unmarshalling XML fails.
public JaxbRepresentation(Representation xmlRepresentation,
String contextPath)
xmlRepresentation - The XML wrapped in a representation.contextPath - The list of Java package names for JAXB.
JAXBException - If the incoming XML does not validate against the schema.
IOException - If unmarshalling XML fails.
public JaxbRepresentation(Representation xmlRepresentation,
String contextPath,
ValidationEventHandler validationHandler)
xmlRepresentation - The XML wrapped in a representation.contextPath - The list of Java package names for JAXB.validationHandler - A handler for dealing with validation failures.
JAXBException - If the incoming XML does not validate against the schema.
IOException - If unmarshalling XML fails.
public JaxbRepresentation(Representation xmlRepresentation,
String contextPath,
ValidationEventHandler validationHandler,
ClassLoader classLoader)
xmlRepresentation - The XML wrapped in a representation.contextPath - The list of Java package names for JAXB.validationHandler - A handler for dealing with validation failures.classLoader - The classloader to use for JAXB annotated classes.
JAXBException - If the incoming XML does not validate against the schema.
IOException - If unmarshalling XML fails.public JaxbRepresentation(T object)
MediaType.APPLICATION_XML.
object - The Java object.| Method Detail |
|---|
public static JAXBContext getContext(String contextPath)
throws JAXBException
contextPath - The JAXB context path.
JAXBException
public static JAXBContext getContext(String contextPath,
ClassLoader classLoader)
throws JAXBException
contextPath - The JAXB context path.classLoader - The JAXB classloader to use for annotated JAXB classes.
JAXBExceptionpublic ClassLoader getClassLoader()
public JAXBContext getContext()
throws JAXBException
JAXBExceptionpublic String getContextPath()
public JAXBSource getJaxbSource()
throws IOException
IOExceptionpublic com.sun.xml.bind.marshaller.NamespacePrefixMapper getNamespacePrefixMapper()
public String getNoNamespaceSchemaLocation()
public T getObject()
throws IOException
IOExceptionpublic String getSchemaLocation()
public ValidationEventHandler getValidationEventHandler()
public boolean isFormattedOutput()
public boolean isFragment()
public void setClassLoader(ClassLoader classLoader)
classLoader - The classloader to use for JAXB annotated classes.public void setContextPath(String contextPath)
contextPath - The JAXB context path.public void setFormattedOutput(boolean formattedOutput)
formattedOutput - True if the resulting XML data should be formatted.public void setFragment(boolean fragment)
fragment - True if the document level events will be generated by the
Marshaller.public void setNamespacePrefixMapper(com.sun.xml.bind.marshaller.NamespacePrefixMapper namespacePrefixMapper)
namespacePrefixMapper - The optional namespace prefix mapper for marshalling.public void setNoNamespaceSchemaLocation(String noNamespaceSchemaLocation)
noNamespaceSchemaLocation - The "xsi:noNamespaceSchemaLocation" attribute in the generated
XML data.public void setObject(T object)
object - The Java object to set.public void setSchemaLocation(String schemaLocation)
schemaLocation - The "xsi:noNamespaceSchemaLocation" attribute in the generated
XML data.public void setValidationEventHandler(ValidationEventHandler validationEventHandler)
validationEventHandler - The optional validation event handler.
public void write(Writer writer)
throws IOException
write in class Representationwriter - The writer to use when writing.
IOException - If any error occurs attempting to write the stream.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||