@InterfaceStability.Experimental @InterfaceAudience.Public public abstract class AbstractSubdocRequest extends AbstractKeyValueRequest implements BinarySubdocRequest
Base class for all BinarySubdocRequest
.
Modifier and Type | Field and Description |
---|---|
static IllegalArgumentException |
EXCEPTION_EMPTY_PATH
An
IllegalArgumentException that is thrown by constructors when a empty path is provided on an operation that doesn’t allow them. |
static NullPointerException |
EXCEPTION_NULL_PATH
A
NullPointerException that is thrown by constructors when a null path is provided. |
DEFAULT_PARTITION
Constructor and Description |
---|
AbstractSubdocRequest(String key,
String path,
String bucket,
ByteBuf... restOfContent)
Creates a new
AbstractSubdocRequest . |
AbstractSubdocRequest(String key,
String path,
String bucket,
Subject<CouchbaseResponse,CouchbaseResponse> observable,
ByteBuf... restOfContent)
Creates a new
AbstractSubdocRequest . |
Modifier and Type | Method and Description |
---|---|
protected void |
cleanUpAndThrow(RuntimeException e)
Utility method to ensure good cleanup when throwing an exception from a constructor.
|
ByteBuf |
content()
The
ByteBuf bearing the full content for this request. |
protected ByteBuf |
createContent(ByteBuf pathByteBuf,
ByteBuf... restOfContent) |
String |
path()
Returns the path inside a JSON document where values will be obtained/mutated.
|
int |
pathLength() |
key, keyBytes, opaque, partition, partition
bucket, creationTime, incrementRetryCount, observable, password, retryCount, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
opcode
key, keyBytes, opaque, partition, partition
bucket, incrementRetryCount, observable, password, retryCount
creationTime
public static final NullPointerException EXCEPTION_NULL_PATH
A NullPointerException
that is thrown by constructors when a null path is provided.
public static final IllegalArgumentException EXCEPTION_EMPTY_PATH
An IllegalArgumentException
that is thrown by constructors when a empty path is provided on an operation that doesn’t allow them.
public AbstractSubdocRequest(String key, String path, String bucket, ByteBuf... restOfContent)
Creates a new AbstractSubdocRequest
.
key
- the key of the document.path
- the subdocument path to consider inside the document.bucket
- the bucket of the document.restOfContent
- the optional remainder of the content()
of the final protocol message, or null if not applicableNullPointerException
- if the path is null (see EXCEPTION_NULL_PATH
)public AbstractSubdocRequest(String key, String path, String bucket, Subject<CouchbaseResponse,CouchbaseResponse> observable, ByteBuf... restOfContent)
Creates a new AbstractSubdocRequest
.
key
- the key of the document.path
- the subdocument path to consider inside the document.bucket
- the bucket of the document.observable
- the observable which receives responses.restOfContent
- the optional remainder of the content()
of the final protocol message, or null if not applicableNullPointerException
- if the path is null (see EXCEPTION_NULL_PATH
)protected void cleanUpAndThrow(RuntimeException e)
Utility method to ensure good cleanup when throwing an exception from a constructor.
Cleans the content composite buffer by releasing it before throwing the exception.
public String path()
BinarySubdocRequest
Returns the path inside a JSON document where values will be obtained/mutated. Some sub-document operations authorize the use of an empty path while other don’t.
path
in interface BinarySubdocRequest
public int pathLength()
pathLength
in interface BinarySubdocRequest
BinarySubdocRequest.content()
(can serve as an offset from 0 to find the path in the content).public ByteBuf content()
BinarySubdocRequest
The ByteBuf
bearing the full content for this request. The content is at a minimum comprised of the BinarySubdocRequest.path()
as UTF8 bytes, and can also have any other relevant payload appended (eg. a JSON fragment for mutative operations, see BinarySubdocMutationRequest.fragment()
).
This buffer is to be automatically released once the message has been written on the wire.
content
in interface BinarySubdocRequest
Copyright © 2016 Couchbase, Inc.. All rights reserved.