C - one of the classes (or the <?> wildcard for any of the classes) registered with the JAXB ContextContentDescriptor, AbstractReadHandle, AbstractWriteHandle, BufferableHandle, ContentHandle<C>, SPARQLResultsReadHandle, TriplesReadHandle, TriplesWriteHandle, XMLReadHandle, XMLWriteHandle, OutputStreamSenderpublic class JAXBHandle<C> extends BaseHandle<java.io.InputStream,OutputStreamSender> implements OutputStreamSender, BufferableHandle, ContentHandle<C>, XMLReadHandle, XMLWriteHandle
UNKNOWN_LENGTH| Constructor | Description |
|---|---|
JAXBHandle(javax.xml.bind.JAXBContext context) |
Initializes the JAXB handle with the JAXB context for the classes
of the marshalled or unmarshalled structure.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
fromBuffer(byte[] buffer) |
fromBuffer() unmarshals a JAXB POJO from a byte array
buffer.
|
C |
get() |
Returns the root object of the JAXB structure for the content.
|
<T> T |
get(java.lang.Class<T> as) |
Returns the root object of the JAXB structure for the content
cast to a more specific class.
|
javax.xml.bind.Marshaller |
getMarshaller() |
Returns the marshaller that converts a tree data structure
from Java objects to XML, reusing any existing marshaller.
|
javax.xml.bind.Marshaller |
getMarshaller(boolean reuse) |
Returns the marshaller that converts a tree data structure
from Java objects to XML.
|
javax.xml.bind.Unmarshaller |
getUnmarshaller() |
Returns the unmarshaller that converts a tree data structure
from XML to Java objects, reusing any existing unmarshaller.
|
javax.xml.bind.Unmarshaller |
getUnmarshaller(boolean reuse) |
Returns the unmarshaller that converts a tree data structure
from XML to Java objects.
|
static ContentHandleFactory |
newFactory(java.lang.Class<?>... pojoClasses) |
Creates a factory to create a JAXBHandle instance for POJO instances
of the specified classes.
|
static ContentHandleFactory |
newFactory(javax.xml.bind.JAXBContext context,
java.lang.Class<?>... pojoClasses) |
Creates a factory to create a JAXBHandle instance for POJO instances
of the specified classes.
|
protected java.lang.Class<java.io.InputStream> |
receiveAs() |
|
protected void |
receiveContent(java.io.InputStream content) |
|
protected OutputStreamSender |
sendContent() |
|
void |
set(C content) |
Assigns the root object of the JAXB structure for the content.
|
void |
setFormat(Format format) |
Restricts the format to XML.
|
byte[] |
toBuffer() |
Copies the content of the handle to a byte array buffer
encoded in UTF-8.
|
java.lang.String |
toString() |
Returns the JAXB structure as an XML string.
|
JAXBHandle<C> |
with(C content) |
Assigns the root object of the JAXB structure for the content
and returns the handle as a fluent convenience.
|
JAXBHandle<C> |
withMimetype(java.lang.String mimetype) |
Specifies the mime type of the content and returns the handle
as a fluent convenience.
|
void |
write(java.io.OutputStream out) |
Implements a callback to write content to the provided output stream
for sending to the database server.
|
getByteLength, getFormat, getMimetype, getServerTimestamp, setByteLength, setMimetype, setServerTimestamppublic JAXBHandle(javax.xml.bind.JAXBContext context)
context - the JAXB contextpublic static ContentHandleFactory newFactory(java.lang.Class<?>... pojoClasses) throws javax.xml.bind.JAXBException
pojoClasses - the POJO classes for which this factory provides a handlejavax.xml.bind.JAXBException - if a JAXB error occurs while initializing the new factorypublic static ContentHandleFactory newFactory(javax.xml.bind.JAXBContext context, java.lang.Class<?>... pojoClasses) throws javax.xml.bind.JAXBException
context - the JAXB context for marshaling the POJO classespojoClasses - the POJO classes for which this factory provides a handlejavax.xml.bind.JAXBException - if a JAXB error occurs while initializing the new factorypublic C get()
get in interface ContentHandle<C>public <T> T get(java.lang.Class<T> as)
T - the type to returnas - the class of the objectpublic void set(C content)
set in interface ContentHandle<C>content - the root JAXB objectpublic JAXBHandle<C> with(C content)
content - the root JAXB objectpublic void setFormat(Format format)
setFormat in interface ContentDescriptorsetFormat in class BaseHandle<java.io.InputStream,OutputStreamSender>format - the format of the contentpublic JAXBHandle<C> withMimetype(java.lang.String mimetype)
mimetype - the mime type of the contentpublic void fromBuffer(byte[] buffer)
fromBuffer in interface BufferableHandlebuffer - the byte arraypublic byte[] toBuffer()
BufferableHandletoBuffer in interface BufferableHandlepublic java.lang.String toString()
toString in class java.lang.Objectpublic javax.xml.bind.Unmarshaller getUnmarshaller()
throws javax.xml.bind.JAXBException
javax.xml.bind.JAXBException - if unmarshaller initialization failspublic javax.xml.bind.Unmarshaller getUnmarshaller(boolean reuse)
throws javax.xml.bind.JAXBException
reuse - whether to reuse an existing unmarshallerjavax.xml.bind.JAXBException - if unmarshaller initialization failspublic javax.xml.bind.Marshaller getMarshaller()
throws javax.xml.bind.JAXBException
javax.xml.bind.JAXBException - if marshaller initialization failspublic javax.xml.bind.Marshaller getMarshaller(boolean reuse)
throws javax.xml.bind.JAXBException
reuse - whether to reuse an existing marshallerjavax.xml.bind.JAXBException - if marshaller initialization failsprotected java.lang.Class<java.io.InputStream> receiveAs()
receiveAs in class com.marklogic.client.impl.HandleImplementation<java.io.InputStream,OutputStreamSender>protected void receiveContent(java.io.InputStream content)
receiveContent in class com.marklogic.client.impl.HandleImplementation<java.io.InputStream,OutputStreamSender>protected OutputStreamSender sendContent()
sendContent in class com.marklogic.client.impl.HandleImplementation<java.io.InputStream,OutputStreamSender>public void write(java.io.OutputStream out)
throws java.io.IOException
OutputStreamSenderwrite in interface OutputStreamSenderout - the output stream receiving the contentjava.io.IOException - if io problems ariseCopyright © 2013-2019 MarkLogic Corporation.