Class AbstractSubdocMutationRequest
- java.lang.Object
-
- com.couchbase.client.core.message.AbstractCouchbaseRequest
-
- com.couchbase.client.core.message.kv.AbstractKeyValueRequest
-
- com.couchbase.client.core.message.kv.subdoc.simple.AbstractSubdocRequest
-
- com.couchbase.client.core.message.kv.subdoc.simple.AbstractSubdocMutationRequest
-
- All Implemented Interfaces:
CouchbaseMessage
,CouchbaseRequest
,BinaryRequest
,BinarySubdocMutationRequest
,BinarySubdocRequest
- Direct Known Subclasses:
SubArrayRequest
,SubCounterRequest
,SubDeleteRequest
,SubDictAddRequest
,SubDictUpsertRequest
,SubReplaceRequest
@Committed @Public public abstract class AbstractSubdocMutationRequest extends AbstractSubdocRequest implements BinarySubdocMutationRequest
Base class for allBinarySubdocMutationRequest
.- Since:
- 1.2
- Author:
- Simon Baslé
-
-
Field Summary
-
Fields inherited from class com.couchbase.client.core.message.kv.subdoc.simple.AbstractSubdocRequest
EXCEPTION_EMPTY_PATH, EXCEPTION_NULL_PATH
-
Fields inherited from class com.couchbase.client.core.message.kv.AbstractKeyValueRequest
DEFAULT_PARTITION
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractSubdocMutationRequest(String key, String path, ByteBuf fragment, String bucket, int expiration, long cas)
Creates a newAbstractSubdocMutationRequest
.protected
AbstractSubdocMutationRequest(String key, String path, ByteBuf fragment, String bucket, int expiration, long cas, rx.subjects.Subject<CouchbaseResponse,CouchbaseResponse> observable)
Creates a newAbstractSubdocMutationRequest
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
cas()
boolean
createDocument()
Create document if it does not exist.void
createDocument(boolean createDocument)
boolean
createIntermediaryPath()
Sets whether missing nodes in theBinarySubdocRequest.path()
should be created as part of this mutation, when possible.void
createIntermediaryPath(boolean createIntermediaryPath)
Modifies the request so that it requires the creation of missing intermediary nodes in the path if set to true.boolean
expandMacros()
Sets whether macros such as ${Mutation.CAS} should be expandedvoid
expandMacros(boolean expandMacros)
int
expiration()
ByteBuf
fragment()
AByteBuf
containing the JSON fragment for the mutation.boolean
insertDocument()
Add document only if it does not existvoid
insertDocument(boolean insertDocument)
boolean
upsertDocument()
Upsert document if it does not existvoid
upsertDocument(boolean upsertDocument)
boolean
xattr()
Access to extended attribute section of the couchbase documentvoid
xattr(boolean xattr)
-
Methods inherited from class com.couchbase.client.core.message.kv.subdoc.simple.AbstractSubdocRequest
cleanUpAndThrow, content, createContent, path, pathLength
-
Methods inherited from class com.couchbase.client.core.message.kv.AbstractKeyValueRequest
afterSpanSet, key, keyBytes, opaque, operationId, partition, partition
-
Methods inherited from class com.couchbase.client.core.message.AbstractCouchbaseRequest
bucket, complete, creationTime, dispatchHostname, dispatchHostname, emit, fail, incrementRetryCount, isActive, lastLocalId, lastLocalId, lastLocalSocket, lastLocalSocket, lastRemoteSocket, lastRemoteSocket, maxRetryDuration, maxRetryDuration, observable, password, retryAfter, retryAfter, retryCount, retryDelay, retryDelay, span, span, subscriber, succeed, toString, username
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.couchbase.client.core.message.kv.BinaryRequest
key, keyBytes, opaque, partition, partition
-
Methods inherited from interface com.couchbase.client.core.message.kv.subdoc.BinarySubdocRequest
content, opcode, path, pathLength
-
Methods inherited from interface com.couchbase.client.core.message.CouchbaseMessage
creationTime
-
Methods inherited from interface com.couchbase.client.core.message.CouchbaseRequest
bucket, complete, dispatchHostname, dispatchHostname, emit, fail, incrementRetryCount, isActive, lastLocalId, lastLocalId, lastLocalSocket, lastLocalSocket, lastRemoteSocket, lastRemoteSocket, maxRetryDuration, maxRetryDuration, observable, operationId, password, retryAfter, retryAfter, retryCount, retryDelay, retryDelay, span, span, subscriber, succeed, username
-
-
-
-
Constructor Detail
-
AbstractSubdocMutationRequest
protected AbstractSubdocMutationRequest(String key, String path, ByteBuf fragment, String bucket, int expiration, long cas)
Creates a newAbstractSubdocMutationRequest
.- Parameters:
key
- the key of the document.path
- the subdocument path to consider inside the document.fragment
- the fragment of valid JSON to mutate into at the site denoted by the path.bucket
- the bucket of the document.expiration
- the TTL of the whole enclosing document.cas
- the cas value for the operation- Throws:
NullPointerException
- if the path is null (seeAbstractSubdocRequest.EXCEPTION_NULL_PATH
)
-
AbstractSubdocMutationRequest
protected AbstractSubdocMutationRequest(String key, String path, ByteBuf fragment, String bucket, int expiration, long cas, rx.subjects.Subject<CouchbaseResponse,CouchbaseResponse> observable)
Creates a newAbstractSubdocMutationRequest
.- Parameters:
key
- the key of the document.path
- the subdocument path to consider inside the document.fragment
- the fragment of valid JSON to mutate into at the site denoted by the path.bucket
- the bucket of the document.expiration
- the TTL of the whole enclosing document.cas
- the cas value for the operationobservable
- the observable which receives responses.- Throws:
NullPointerException
- if the path is null (seeAbstractSubdocRequest.EXCEPTION_NULL_PATH
)
-
-
Method Detail
-
expiration
public int expiration()
- Specified by:
expiration
in interfaceBinarySubdocMutationRequest
- Returns:
- the expiration (or TTL) to apply to the document along the mutation, 0 for no TTL.
-
fragment
public ByteBuf fragment()
Description copied from interface:BinarySubdocMutationRequest
AByteBuf
containing the JSON fragment for the mutation. It is appended to theBinarySubdocRequest.content()
. This buffer is to be automatically released once the content has been written on the wire.- Specified by:
fragment
in interfaceBinarySubdocMutationRequest
- Returns:
- the target value for the mutation (a fragment of the whole JSON document, valid JSON itself)
-
createIntermediaryPath
public boolean createIntermediaryPath()
Description copied from interface:BinarySubdocMutationRequest
Sets whether missing nodes in theBinarySubdocRequest.path()
should be created as part of this mutation, when possible. This is represented as an additional flag on the wire.- Specified by:
createIntermediaryPath
in interfaceBinarySubdocMutationRequest
- Returns:
- true if missing JSON nodes in the path should be created, false otherwise.
-
createIntermediaryPath
public void createIntermediaryPath(boolean createIntermediaryPath)
Modifies the request so that it requires the creation of missing intermediary nodes in the path if set to true.- Parameters:
createIntermediaryPath
- true if missing intermediary nodes in the path should be created, false if they should be considered as errors.
-
xattr
public boolean xattr()
Description copied from interface:BinarySubdocMutationRequest
Access to extended attribute section of the couchbase document- Specified by:
xattr
in interfaceBinarySubdocMutationRequest
- Returns:
- true if accessing extended attribute section
-
xattr
public void xattr(boolean xattr)
-
expandMacros
public boolean expandMacros()
Description copied from interface:BinarySubdocMutationRequest
Sets whether macros such as ${Mutation.CAS} should be expanded- Specified by:
expandMacros
in interfaceBinarySubdocMutationRequest
- Returns:
- true iff macros should be expanded
-
expandMacros
public void expandMacros(boolean expandMacros)
-
cas
public long cas()
- Specified by:
cas
in interfaceBinarySubdocMutationRequest
- Returns:
- the CAS to use for the mutation (if needed) or 0L to ignore
-
createDocument
public boolean createDocument()
Description copied from interface:BinarySubdocMutationRequest
Create document if it does not exist. It is deprecated, useBinarySubdocMutationRequest.upsertDocument()
- Specified by:
createDocument
in interfaceBinarySubdocMutationRequest
- Returns:
- true if creating document
-
createDocument
public void createDocument(boolean createDocument)
-
upsertDocument
public boolean upsertDocument()
Description copied from interface:BinarySubdocMutationRequest
Upsert document if it does not exist- Specified by:
upsertDocument
in interfaceBinarySubdocMutationRequest
- Returns:
- true if creating document
-
upsertDocument
public void upsertDocument(boolean upsertDocument)
-
insertDocument
public boolean insertDocument()
Description copied from interface:BinarySubdocMutationRequest
Add document only if it does not exist- Specified by:
insertDocument
in interfaceBinarySubdocMutationRequest
- Returns:
- true if adding document
-
insertDocument
public void insertDocument(boolean insertDocument)
-
-