Class JsonArrayTranscoder
java.lang.Object
com.couchbase.client.java.transcoder.AbstractTranscoder<JsonArrayDocument,JsonArray>
com.couchbase.client.java.transcoder.JsonArrayTranscoder
- All Implemented Interfaces:
Transcoder<JsonArrayDocument,JsonArray>
public class JsonArrayTranscoder extends AbstractTranscoder<JsonArrayDocument,JsonArray>
A transcoder to encode and decode
JsonDocument
s.- Since:
- 2.0
- Author:
- Michael Nitschinger
-
Constructor Summary
Constructors Constructor Description JsonArrayTranscoder()
-
Method Summary
Modifier and Type Method Description JsonArray
byteBufToJsonArray(com.couchbase.client.deps.io.netty.buffer.ByteBuf input)
Class<JsonArrayDocument>
documentType()
protected JsonArrayDocument
doDecode(String id, com.couchbase.client.deps.io.netty.buffer.ByteBuf content, long cas, int expiry, int flags, ResponseStatus status)
Perform the decoding of the received response.protected Tuple2<com.couchbase.client.deps.io.netty.buffer.ByteBuf,Integer>
doEncode(JsonArrayDocument document)
Perform the encoding of the request document.com.couchbase.client.deps.io.netty.buffer.ByteBuf
jsonArrayToByteBuf(JsonArray input)
String
jsonArrayToString(JsonArray input)
JsonArrayDocument
newDocument(String id, int expiry, JsonArray content, long cas)
Creates a new Document with the passed in information.JsonArrayDocument
newDocument(String id, int expiry, JsonArray content, long cas, MutationToken mutationToken)
Default implementation for backwards compatibility.JsonArray
stringToJsonArray(String input)
Methods inherited from class com.couchbase.client.java.transcoder.AbstractTranscoder
decode, encode, shouldAutoReleaseOnDecode, shouldAutoReleaseOnError
-
Constructor Details
-
JsonArrayTranscoder
public JsonArrayTranscoder()
-
-
Method Details
-
documentType
-
doEncode
protected Tuple2<com.couchbase.client.deps.io.netty.buffer.ByteBuf,Integer> doEncode(JsonArrayDocument document) throws ExceptionDescription copied from class:AbstractTranscoder
Perform the encoding of the request document.- Specified by:
doEncode
in classAbstractTranscoder<JsonArrayDocument,JsonArray>
- Parameters:
document
- the document to encode.- Returns:
- A tuple consisting of the encoded content and the flags to set.
- Throws:
Exception
- if something goes wrong during the encode process.
-
doDecode
protected JsonArrayDocument doDecode(String id, com.couchbase.client.deps.io.netty.buffer.ByteBuf content, long cas, int expiry, int flags, ResponseStatus status) throws ExceptionDescription copied from class:AbstractTranscoder
Perform the decoding of the received response.- Specified by:
doDecode
in classAbstractTranscoder<JsonArrayDocument,JsonArray>
- Parameters:
id
- the id of the document.content
- the encoded content of the document.cas
- the cas value of the document.expiry
- the expiration time of the document.flags
- the flags set on the document.status
- the response status.- Returns:
- the decoded document.
- Throws:
Exception
- if something goes wrong during the decode process.
-
newDocument
Description copied from interface:Transcoder
Creates a new Document with the passed in information. Use the one with the mutation token instead (Transcoder.newDocument(String, int, Object, long, MutationToken)
).- Parameters:
id
- the id of the document.expiry
- the document expiration.content
- the document content.cas
- the documents cas value.- Returns:
- the created document.
-
newDocument
public JsonArrayDocument newDocument(String id, int expiry, JsonArray content, long cas, MutationToken mutationToken)Description copied from class:AbstractTranscoder
Default implementation for backwards compatibility.- Specified by:
newDocument
in interfaceTranscoder<JsonArrayDocument,JsonArray>
- Overrides:
newDocument
in classAbstractTranscoder<JsonArrayDocument,JsonArray>
- Parameters:
id
- the id of the document.expiry
- the document expiration.content
- the document content.cas
- the documents cas value.mutationToken
- the documents mutation token.- Returns:
- the created document.
-
jsonArrayToString
- Throws:
Exception
-
jsonArrayToByteBuf
public com.couchbase.client.deps.io.netty.buffer.ByteBuf jsonArrayToByteBuf(JsonArray input) throws Exception- Throws:
Exception
-
stringToJsonArray
- Throws:
Exception
-
byteBufToJsonArray
public JsonArray byteBufToJsonArray(com.couchbase.client.deps.io.netty.buffer.ByteBuf input) throws Exception- Throws:
Exception
-