public abstract class AbstractTranscoder<D extends Document<T>,T> extends Object implements Transcoder<D,T>
Base Transcoder
which should be extended for compatibility.
Constructor and Description |
---|
AbstractTranscoder() |
Modifier and Type | Method and Description |
---|---|
D |
decode(String id,
com.couchbase.client.deps.io.netty.buffer.ByteBuf content,
long cas,
int expiry,
int flags,
ResponseStatus status) |
protected abstract D |
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 abstract Tuple2<com.couchbase.client.deps.io.netty.buffer.ByteBuf,Integer> |
doEncode(D document)
Perform the encoding of the request document.
|
Tuple2<com.couchbase.client.deps.io.netty.buffer.ByteBuf,Integer> |
encode(D document) |
D |
newDocument(String id,
int expiry,
T content,
long cas,
MutationToken mutationToken)
Default implementation for backwards compatibility.
|
protected boolean |
shouldAutoReleaseOnDecode()
Flag method to auto release decoded buffers.
|
protected boolean |
shouldAutoReleaseOnError()
Flag method to auto release buffers on decoding error.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
documentType, newDocument
public D decode(String id, com.couchbase.client.deps.io.netty.buffer.ByteBuf content, long cas, int expiry, int flags, ResponseStatus status)
protected abstract D doDecode(String id, com.couchbase.client.deps.io.netty.buffer.ByteBuf content, long cas, int expiry, int flags, ResponseStatus status) throws Exception
Perform the decoding of the received response.
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.Exception
- if something goes wrong during the decode process.protected abstract Tuple2<com.couchbase.client.deps.io.netty.buffer.ByteBuf,Integer> doEncode(D document) throws Exception
Perform the encoding of the request document.
document
- the document to encode.Exception
- if something goes wrong during the encode process.protected boolean shouldAutoReleaseOnDecode()
Flag method to auto release decoded buffers. Override to change default behaviour (true).
ByteBuf
passed to decode
method is to be released automatically on success (default behaviour)protected boolean shouldAutoReleaseOnError()
Flag method to auto release buffers on decoding error. Override to change default behaviour (true).
ByteBuf
passed to decode
method is to be released automatically in case of error (default behaviour)public D newDocument(String id, int expiry, T content, long cas, MutationToken mutationToken)
Default implementation for backwards compatibility.
newDocument
in interface Transcoder<D extends Document<T>,T>
id
- the id of the document.expiry
- the document expiration.content
- the document content.cas
- the documents cas value.mutationToken
- the documents mutation token.Copyright © 2015 Couchbase, Inc.