T
- The type to wrap.public class JaxbRepresentation<T> extends WriterRepresentation
UNKNOWN_SIZE
Constructor and Description |
---|
JaxbRepresentation(MediaType mediaType,
T object)
Creates a JAXB representation from an existing JAXB content tree.
|
JaxbRepresentation(MediaType mediaType,
T object,
java.lang.ClassLoader classloader)
Creates a JAXB representation from an existing JAXB content tree.
|
JaxbRepresentation(Representation xmlRepresentation,
java.lang.Class<T> type)
Creates a new JAXB representation, converting the input XML into a Java
content tree.
|
JaxbRepresentation(Representation xmlRepresentation,
java.lang.Class<T> type,
javax.xml.bind.ValidationEventHandler validationHandler)
Creates a new JAXB representation, converting the input XML into a Java
content tree.
|
JaxbRepresentation(Representation xmlRepresentation,
java.lang.String contextPath)
Creates a new JAXB representation, converting the input XML into a Java
content tree.
|
JaxbRepresentation(Representation xmlRepresentation,
java.lang.String contextPath,
javax.xml.bind.ValidationEventHandler validationHandler)
Creates a new JAXB representation, converting the input XML into a Java
content tree.
|
JaxbRepresentation(Representation xmlRepresentation,
java.lang.String contextPath,
javax.xml.bind.ValidationEventHandler validationHandler,
java.lang.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 . |
Modifier and Type | Method and Description |
---|---|
java.lang.ClassLoader |
getClassLoader()
Returns the classloader to use for JAXB annotated classes.
|
javax.xml.bind.JAXBContext |
getContext()
Returns the JAXB context.
|
static javax.xml.bind.JAXBContext |
getContext(java.lang.String contextPath)
Returns the JAXB context, if possible from the cached contexts.
|
static javax.xml.bind.JAXBContext |
getContext(java.lang.String contextPath,
java.lang.ClassLoader classLoader)
Returns the JAXB context, if possible from the cached contexts.
|
java.lang.String |
getContextPath()
Returns the list of Java package names that contain schema derived class
and/or Java to schema (JAXB-annotated) mapped classes
|
javax.xml.bind.util.JAXBSource |
getJaxbSource()
Returns a JAXB SAX source.
|
com.sun.xml.bind.marshaller.NamespacePrefixMapper |
getNamespacePrefixMapper()
Returns the optional namespace prefix mapper for marshalling.
|
java.lang.String |
getNoNamespaceSchemaLocation()
Returns the "xsi:noNamespaceSchemaLocation" attribute in the generated
XML data.
|
T |
getObject()
Returns the wrapped Java object.
|
java.lang.String |
getSchemaLocation()
Returns the "xsi:schemaLocation" attribute in the generated XML data.
|
javax.xml.bind.ValidationEventHandler |
getValidationEventHandler()
Returns the optional validation event handler.
|
boolean |
isExpandingEntityRefs()
Indicates if the parser will expand entity reference nodes.
|
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.
|
boolean |
isSecureProcessing()
Indicates if it limits potential XML overflow attacks.
|
boolean |
isValidatingDtd()
Indicates the desire for validating this type of XML representations
against an XML schema if one is referenced within the contents.
|
boolean |
isXIncludeAware()
Indicates the desire for processing XInclude if found in this
type of XML representations.
|
void |
setClassLoader(java.lang.ClassLoader classLoader)
Sets the classloader to use for JAXB annotated classes.
|
void |
setContextPath(java.lang.String contextPath)
Sets the list of Java package names that contain schema derived class
and/or Java to schema (JAXB-annotated) mapped classes.
|
void |
setExpandingEntityRefs(boolean expandEntityRefs)
Indicates if the parser will expand entity reference nodes.
|
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(java.lang.String noNamespaceSchemaLocation)
Sets the "xsi:noNamespaceSchemaLocation" attribute in the generated XML
data.
|
void |
setObject(T object)
Sets the wrapped Java object.
|
void |
setSchemaLocation(java.lang.String schemaLocation)
Sets the "xsi:schemaLocation" attribute in the generated XML data.
|
void |
setSecureProcessing(boolean secureProcessing)
Indicates if it limits potential XML overflow attacks.
|
void |
setValidatingDtd(boolean validating)
Indicates the desire for validating this type of XML representations
against an XML schema if one is referenced within the contents.
|
void |
setValidationEventHandler(javax.xml.bind.ValidationEventHandler validationEventHandler)
Sets the validation event handler.
|
void |
setXIncludeAware(boolean includeAware)
Indicates the desire for processing XInclude if found in this
type of XML representations.
|
void |
write(java.io.Writer writer)
Writes the representation to a stream of characters.
|
getReader
getChannel, getStream, write, write
append, exhaust, getAvailableSize, getDigest, getDisposition, getExpirationDate, getRange, getRegistration, getSize, getText, hasKnownSize, isAvailable, isEmpty, isSelectable, isTransient, release, setAvailable, setDigest, setDisposition, setExpirationDate, setListener, setRange, setSize, setTransient
getModificationDate, getTag, setModificationDate, setTag
createClientInfo, equals, getCharacterSet, getEncodings, getLanguages, getLocationRef, getMediaType, hashCode, includes, isCompatible, setCharacterSet, setEncodings, setLanguages, setLocationRef, setLocationRef, setMediaType, toString
public JaxbRepresentation(MediaType mediaType, T object)
mediaType
- The representation's media type.object
- The Java object.public JaxbRepresentation(MediaType mediaType, T object, java.lang.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, java.lang.Class<T> type)
xmlRepresentation
- The XML wrapped in a representation.type
- The type to convert to.javax.xml.bind.JAXBException
- If the incoming XML does not validate against the schema.java.io.IOException
- If unmarshalling XML fails.public JaxbRepresentation(Representation xmlRepresentation, java.lang.Class<T> type, javax.xml.bind.ValidationEventHandler validationHandler)
xmlRepresentation
- The XML wrapped in a representation.type
- The type to convert to.validationHandler
- A handler for dealing with validation failures.javax.xml.bind.JAXBException
- If the incoming XML does not validate against the schema.java.io.IOException
- If unmarshalling XML fails.public JaxbRepresentation(Representation xmlRepresentation, java.lang.String contextPath)
xmlRepresentation
- The XML wrapped in a representation.contextPath
- The list of Java package names for JAXB.javax.xml.bind.JAXBException
- If the incoming XML does not validate against the schema.java.io.IOException
- If unmarshalling XML fails.public JaxbRepresentation(Representation xmlRepresentation, java.lang.String contextPath, javax.xml.bind.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.javax.xml.bind.JAXBException
- If the incoming XML does not validate against the schema.java.io.IOException
- If unmarshalling XML fails.public JaxbRepresentation(Representation xmlRepresentation, java.lang.String contextPath, javax.xml.bind.ValidationEventHandler validationHandler, java.lang.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.javax.xml.bind.JAXBException
- If the incoming XML does not validate against the schema.java.io.IOException
- If unmarshalling XML fails.public JaxbRepresentation(T object)
MediaType.APPLICATION_XML
.object
- The Java object.public static javax.xml.bind.JAXBContext getContext(java.lang.String contextPath) throws javax.xml.bind.JAXBException
contextPath
- The JAXB context path.javax.xml.bind.JAXBException
public static javax.xml.bind.JAXBContext getContext(java.lang.String contextPath, java.lang.ClassLoader classLoader) throws javax.xml.bind.JAXBException
contextPath
- The JAXB context path.classLoader
- The JAXB classloader to use for annotated JAXB classes.javax.xml.bind.JAXBException
public java.lang.ClassLoader getClassLoader()
public javax.xml.bind.JAXBContext getContext() throws javax.xml.bind.JAXBException
javax.xml.bind.JAXBException
public java.lang.String getContextPath()
public javax.xml.bind.util.JAXBSource getJaxbSource() throws java.io.IOException
java.io.IOException
public com.sun.xml.bind.marshaller.NamespacePrefixMapper getNamespacePrefixMapper()
public java.lang.String getNoNamespaceSchemaLocation()
public T getObject() throws java.io.IOException
java.io.IOException
public java.lang.String getSchemaLocation()
public javax.xml.bind.ValidationEventHandler getValidationEventHandler()
public boolean isExpandingEntityRefs()
public boolean isFormattedOutput()
public boolean isFragment()
public boolean isSecureProcessing()
public boolean isValidatingDtd()
public boolean isXIncludeAware()
public void setClassLoader(java.lang.ClassLoader classLoader)
classLoader
- The classloader to use for JAXB annotated classes.public void setContextPath(java.lang.String contextPath)
contextPath
- The JAXB context path.public void setExpandingEntityRefs(boolean expandEntityRefs)
expandEntityRefs
- True if the parser will expand entity reference nodes.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(java.lang.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(java.lang.String schemaLocation)
schemaLocation
- The "xsi:noNamespaceSchemaLocation" attribute in the generated
XML data.public void setSecureProcessing(boolean secureProcessing)
secureProcessing
- True if it limits potential XML overflow attacks.public void setValidatingDtd(boolean validating)
validating
- The new validation flag to set.public void setValidationEventHandler(javax.xml.bind.ValidationEventHandler validationEventHandler)
validationEventHandler
- The optional validation event handler.public void setXIncludeAware(boolean includeAware)
includeAware
- The new value of the xIncludeAware flag.public void write(java.io.Writer writer) throws java.io.IOException
write
in class Representation
writer
- The writer to use when writing.java.io.IOException
- If any error occurs attempting to write the stream.Copyright © 2005-2020 Restlet.