C - one of the classes (or the <?> wildcard for any of the classes) registered with the JAXB ContextContentDescriptor, AbstractReadHandle, AbstractWriteHandle, BufferableContentHandle<C,R>, BufferableHandle, ContentHandle<C>, ResendableContentHandle<C,java.io.InputStream>, SPARQLResultsReadHandle, TriplesReadHandle, TriplesWriteHandle, XMLReadHandle, XMLWriteHandle, OutputStreamSenderpublic class JAXBHandle<C> extends BaseHandle<java.io.InputStream,OutputStreamSender> implements ResendableContentHandle<C,java.io.InputStream>, OutputStreamSender, 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.
|
JAXBHandle(javax.xml.bind.JAXBContext context,
java.lang.Class<C> contentClass) |
Initializes the JAXB handle with the JAXB context for the classes
of the marshalled or unmarshalled structure.
|
| Modifier and Type | Method | Description |
|---|---|---|
C |
bytesToContent(byte[] buffer) |
Converts a byte serialization to the content representation.
|
byte[] |
contentToBytes(C content) |
Converts the content representation to bytes.
|
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.
|
java.lang.Class<C> |
getContentClass() |
Returns the class of the handled content, which may be a base
class of the actual class of a content object.
|
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.
|
JAXBHandle<C> |
newHandle() |
Constructs a new handle for the same content representation,
initializing the new handle with the same format and mime type.
|
JAXBHandle<C>[] |
newHandleArray(int length) |
Constructs an uninitialized array with the specified length with items
of the same content representation.
|
protected java.lang.Class<java.io.InputStream> |
receiveAs() |
|
protected void |
receiveContent(java.io.InputStream serialization) |
|
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.
|
C |
toContent(java.io.InputStream serialization) |
Converts the serialization to the content representation.
|
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, setServerTimestampresendableHandleFornewArraygetPointInTimeQueryTimestamp, isResendable, setPointInTimeQueryTimestamp, setResendable, setResponseServerTimestampclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitnewHandle, resendableHandleForpublic JAXBHandle(javax.xml.bind.JAXBContext context)
context - the JAXB contextpublic JAXBHandle(javax.xml.bind.JAXBContext context,
java.lang.Class<C> contentClass)
context - the JAXB contextcontentClass - the class of the contentpublic 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)
context - the JAXB context for marshaling the POJO classespojoClasses - the POJO classes for which this factory provides a handlepublic 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 java.lang.Class<C> getContentClass()
ContentHandlegetContentClass in interface ContentHandle<C>public JAXBHandle<C> newHandle()
ContentHandlenewHandle in interface BufferableContentHandle<C,R>newHandle in interface ContentHandle<C>newHandle in interface ResendableContentHandle<C,java.io.InputStream>public JAXBHandle<C>[] newHandleArray(int length)
BufferableContentHandlenewHandleArray in interface BufferableContentHandle<C,R>newHandleArray in interface ResendableContentHandle<C,java.io.InputStream>length - the number of positions in the arraypublic 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 C bytesToContent(byte[] buffer)
BufferableContentHandlebytesToContent in interface BufferableContentHandle<C,R>buffer - the byte serializationpublic byte[] contentToBytes(C content)
BufferableContentHandlecontentToBytes in interface BufferableContentHandle<C,R>content - the contentpublic C toContent(java.io.InputStream serialization)
BufferableContentHandletoContent in interface BufferableContentHandle<C,R>serialization - a serialization of the contentpublic 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 serialization)
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-2021 MarkLogic Corporation.