public class JacksonHandle extends com.marklogic.client.impl.JacksonBaseHandle<com.fasterxml.jackson.databind.JsonNode> implements ResendableContentHandle<com.fasterxml.jackson.databind.JsonNode,java.io.InputStream>, OutputStreamSender, JSONReadHandle, JSONWriteHandle, StructureReadHandle, StructureWriteHandle, CtsQueryWriteHandle, SPARQLResultsReadHandle
UNKNOWN_LENGTH
Constructor and Description |
---|
JacksonHandle()
Zero-argument constructor.
|
JacksonHandle(com.fasterxml.jackson.databind.JsonNode content)
Provides a handle on JSON content as a Jackson tree.
|
Modifier and Type | Method and Description |
---|---|
com.fasterxml.jackson.databind.JsonNode |
get()
Returns the root node of the JSON tree.
|
java.lang.Class<com.fasterxml.jackson.databind.JsonNode> |
getContentClass()
Returns the class of the handled content, which may be a base
class of the actual class of a content object.
|
protected boolean |
hasContent() |
com.fasterxml.jackson.databind.JsonNode[] |
newArray(int length)
Constructs an array for the handled content representation
|
static ContentHandleFactory |
newFactory()
Creates a factory to create a JacksonHandle instance for a JSON node.
|
JacksonHandle |
newHandle()
Constructs a new handle for the same content representation,
initializing the new handle with the same format and mime type.
|
protected void |
receiveContent(java.io.InputStream content) |
protected OutputStreamSender |
sendContent() |
protected OutputStreamSender |
sendContent(com.fasterxml.jackson.databind.JsonNode content) |
void |
set(com.fasterxml.jackson.databind.JsonNode content)
Assigns a JSON tree as the content.
|
com.fasterxml.jackson.databind.JsonNode |
toContent(java.io.InputStream serialization)
Converts the serialization to the content representation.
|
JacksonHandle |
with(com.fasterxml.jackson.databind.JsonNode content)
Assigns a JSON tree as the content and returns the handle.
|
JacksonHandle |
withFormat(Format format)
Specifies the format of the content and returns the handle
as a fluent convenience.
|
JacksonHandle |
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.
|
bytesToContent, contentToBytes, fromBuffer, getMapper, receiveAs, setMapper, toBuffer, toString
getByteLength, getFormat, getMimetype, getServerTimestamp, setByteLength, setFormat, setMimetype, setServerTimestamp
getPointInTimeQueryTimestamp, isResendable, setPointInTimeQueryTimestamp, setResendable, setResponseServerTimestamp
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
resendableHandleFor
bytesToContent, contentToBytes, resendableHandleFor
fromBuffer, toBuffer
newHandle
public JacksonHandle()
public JacksonHandle(com.fasterxml.jackson.databind.JsonNode content)
content
- the JSON root node of the tree.public static ContentHandleFactory newFactory()
public JacksonHandle withFormat(Format format)
format
- the format of the contentpublic JacksonHandle withMimetype(java.lang.String mimetype)
mimetype
- the mime type of the contentpublic com.fasterxml.jackson.databind.JsonNode get()
get
in interface ContentHandle<com.fasterxml.jackson.databind.JsonNode>
get
in class com.marklogic.client.impl.JacksonBaseHandle<com.fasterxml.jackson.databind.JsonNode>
public void set(com.fasterxml.jackson.databind.JsonNode content)
set
in interface ContentHandle<com.fasterxml.jackson.databind.JsonNode>
set
in class com.marklogic.client.impl.JacksonBaseHandle<com.fasterxml.jackson.databind.JsonNode>
content
- the JSON root node.public JacksonHandle with(com.fasterxml.jackson.databind.JsonNode content)
content
- the JSON root node.public java.lang.Class<com.fasterxml.jackson.databind.JsonNode> getContentClass()
ContentHandle
getContentClass
in interface ContentHandle<com.fasterxml.jackson.databind.JsonNode>
public JacksonHandle newHandle()
ContentHandle
newHandle
in interface ContentHandle<com.fasterxml.jackson.databind.JsonNode>
public com.fasterxml.jackson.databind.JsonNode[] newArray(int length)
ContentHandle
newArray
in interface ContentHandle<com.fasterxml.jackson.databind.JsonNode>
length
- the size of the array (zero or more)public com.fasterxml.jackson.databind.JsonNode toContent(java.io.InputStream serialization)
BufferableContentHandle
toContent
in interface BufferableContentHandle<com.fasterxml.jackson.databind.JsonNode,java.io.InputStream>
toContent
in class com.marklogic.client.impl.JacksonBaseHandle<com.fasterxml.jackson.databind.JsonNode>
serialization
- a serialization of the contentprotected OutputStreamSender sendContent(com.fasterxml.jackson.databind.JsonNode content)
sendContent
in class com.marklogic.client.impl.JacksonBaseHandle<com.fasterxml.jackson.databind.JsonNode>
protected OutputStreamSender sendContent()
sendContent
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 boolean hasContent()
hasContent
in class com.marklogic.client.impl.JacksonBaseHandle<com.fasterxml.jackson.databind.JsonNode>
public void write(java.io.OutputStream out) throws java.io.IOException
OutputStreamSender
write
in interface OutputStreamSender
out
- the output stream receiving the contentjava.io.IOException
- if io problems ariseCopyright © 2013-2020 MarkLogic Corporation.