@InterfaceStability.Experimental @InterfaceAudience.Public public abstract class AbstractFragmentTranscoder extends Object implements FragmentTranscoder
A common implementation base of the FragmentTranscoder interface for transcoding sub-document fragments. It recognizes MultiValue as a special encoding case to be treated separately.
| Constructor and Description |
|---|
AbstractFragmentTranscoder() |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
decode(com.couchbase.client.deps.io.netty.buffer.ByteBuf encoded,
Class<? extends T> clazz)
Decode content in a
ByteBuf without releasing it. |
protected abstract com.couchbase.client.deps.io.netty.buffer.ByteBuf |
doEncodeMulti(MultiValue<?> multiValue,
String transcodingErrorMessage)
Encode a
special mutation value that denotes multiple values being processed in bulk, to a ByteBuf suitable for use in the sub-document protocol. |
protected abstract <T> com.couchbase.client.deps.io.netty.buffer.ByteBuf |
doEncodeSingle(T value,
String transcodingErrorMessage)
Encode a single mutation value to a
ByteBuf suitable for use in the sub-document protocol. |
<T> com.couchbase.client.deps.io.netty.buffer.ByteBuf |
encode(T value)
Encode a value to a
ByteBuf suitable for use in the sub-document protocol. |
<T> com.couchbase.client.deps.io.netty.buffer.ByteBuf |
encodeWithMessage(T value,
String transcodingErrorMessage)
Encode a value to a
ByteBuf suitable for use in the sub-document protocol. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdecodeWithMessagepublic <T> T decode(com.couchbase.client.deps.io.netty.buffer.ByteBuf encoded,
Class<? extends T> clazz)
throws TranscodingException
FragmentTranscoderDecode content in a ByteBuf without releasing it. Suitable for populating a DocumentFragment’s content.
decode in interface FragmentTranscoderencoded - the encoded fragment value (will not be released).clazz - the target class for decoded value. Using Object.class implies a generic decode, where dictionaries are represented by JsonObject and arrays by JsonArray.TranscodingException - if the decoding couldn’t happen.public <T> com.couchbase.client.deps.io.netty.buffer.ByteBuf encode(T value)
throws TranscodingException
FragmentTranscoderEncode a value to a ByteBuf suitable for use in the sub-document protocol.
encode in interface FragmentTranscodervalue - the value to encode.ByteBuf representation of the fragment value.TranscodingException - if the encoding couldn’t happen.public <T> com.couchbase.client.deps.io.netty.buffer.ByteBuf encodeWithMessage(T value,
String transcodingErrorMessage)
throws TranscodingException
FragmentTranscoderEncode a value to a ByteBuf suitable for use in the sub-document protocol.
encodeWithMessage in interface FragmentTranscodervalue - the value to encode.transcodingErrorMessage - the error message to be used in the thrown TranscodingException if the encoding couldn’t happen.ByteBuf representation of the fragment value.TranscodingException - if the encoding couldn’t happen.protected abstract <T> com.couchbase.client.deps.io.netty.buffer.ByteBuf doEncodeSingle(T value,
String transcodingErrorMessage)
throws TranscodingException
Encode a single mutation value to a ByteBuf suitable for use in the sub-document protocol.
value - the value to encode.transcodingErrorMessage - the error message to be used in the thrown TranscodingException if the encoding couldn’t happen.T - the type of the fragment being encoded.ByteBuf representation of the fragment value.TranscodingException - if the encoding couldn’t happen.protected abstract com.couchbase.client.deps.io.netty.buffer.ByteBuf doEncodeMulti(MultiValue<?> multiValue, String transcodingErrorMessage) throws TranscodingException
Encode a special mutation value that denotes multiple values being processed in bulk, to a ByteBuf suitable for use in the sub-document protocol.
multiValue - the multivalue to encode.transcodingErrorMessage - the error message to be used in the thrown TranscodingException if the encoding couldn’t happen.ByteBuf representation of the fragment multivalue.TranscodingException - if the encoding couldn’t happen.Copyright © 2015 Couchbase, Inc.