public class LookupInResult extends Object
Constructor and Description |
---|
LookupInResult(com.couchbase.client.core.api.kv.CoreSubdocGetResult core,
JsonSerializer serializer) |
Modifier and Type | Method and Description |
---|---|
long |
cas()
Returns the CAS value of document at the time of loading.
|
<T> T |
contentAs(int index,
Class<T> target)
Decodes the content at the given index into an instance of the target class.
|
<T> T |
contentAs(int index,
TypeRef<T> target)
Decodes the content at the given index into an instance of the target type.
|
JsonArray |
contentAsArray(int index)
Decodes the encoded content at the given index into a
JsonArray . |
byte[] |
contentAsBytes(int index)
Returns the raw JSON bytes of the content at the given index.
|
JsonObject |
contentAsObject(int index)
Decodes the encoded content at the given index into a
JsonObject . |
boolean |
exists(int index)
Allows to check if a value at the given index exists.
|
boolean |
isDeleted()
Returns whether this document was deleted (a tombstone).
|
String |
toString() |
@Stability.Internal public LookupInResult(com.couchbase.client.core.api.kv.CoreSubdocGetResult core, JsonSerializer serializer)
public long cas()
The CAS value is an opaque identifier which is associated with a specific state of the document on the server. It can be used during a subsequent mutation to make sure that the document has not been modified in the meantime.
If document on the server has been modified in the meantime the SDK will raise a CasMismatchException
. In
this case the caller is expected to re-do the whole "fetch-modify-update" cycle again. Please refer to the
SDK documentation for more information on CAS mismatches and subsequent retries.
public <T> T contentAs(int index, Class<T> target)
index
- the index of the subdoc value to decode.target
- the target type to decode into.public <T> T contentAs(int index, TypeRef<T> target)
index
- the index of the subdoc value to decode.target
- the target type to decode into.@Stability.Uncommitted public byte[] contentAsBytes(int index)
Note that if the field is a string then it will be surrounded by quotation marks, as this is the raw response from the server. E.g. "foo" will return a 5-byte array.
index
- the index of the subdoc value to retrieve.public JsonObject contentAsObject(int index)
JsonObject
.index
- the index at which to decode.public JsonArray contentAsArray(int index)
JsonArray
.index
- the index at which to decode.public boolean exists(int index)
index
- the index at which to check.@Stability.Internal public boolean isDeleted()
Will always be false unless LookupInOptions.accessDeleted(boolean)
has been set.
For internal use only: applications should not require it.
Copyright © 2024 Couchbase, Inc.. All rights reserved.