Class LookupInResult
- Direct Known Subclasses:
LookupInReplicaResult
- Since:
- 3.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongcas()Returns the CAS value of document at the time of loading.<T> TDecodes the content at the given index into an instance of the target type.<T> TDecodes the content at the given index into an instance of the target class.contentAsArray(int index) Decodes the encoded content at the given index into aJsonArray.byte[]contentAsBytes(int index) Returns the raw JSON bytes of the content at the given index.contentAsObject(int index) Decodes the encoded content at the given index into aJsonObject.booleanexists(int index) Allows to check if a value at the given index exists.booleanReturns whether this document was deleted (a tombstone).toString()
-
Constructor Details
-
LookupInResult
-
-
Method Details
-
cas
public long cas()Returns the CAS value of document at the time of loading.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. -
contentAs
Decodes the content at the given index into an instance of the target class.- Parameters:
index- the index of the subdoc value to decode.target- the target type to decode into.- Returns:
- the decoded content into the generic type requested.
-
contentAs
Decodes the content at the given index into an instance of the target type.- Parameters:
index- the index of the subdoc value to decode.target- the target type to decode into.- Returns:
- the decoded content into the generic type requested.
-
contentAsBytes
Returns the raw JSON bytes of the content at the given 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.
- Parameters:
index- the index of the subdoc value to retrieve.- Returns:
- the JSON content as a byte array
-
contentAsObject
Decodes the encoded content at the given index into aJsonObject.- Parameters:
index- the index at which to decode.
-
contentAsArray
Decodes the encoded content at the given index into aJsonArray.- Parameters:
index- the index at which to decode.
-
exists
public boolean exists(int index) Allows to check if a value at the given index exists.- Parameters:
index- the index at which to check.- Returns:
- true if a value is present at the index, false otherwise.
-
isDeleted
Returns whether this document was deleted (a tombstone).Will always be false unless
LookupInOptions.accessDeleted(boolean)has been set.For internal use only: applications should not require it.
- Returns:
- whether this document was a tombstone
-
toString
-