Package com.couchbase.client.java.kv
Class LookupInResult
java.lang.Object
com.couchbase.client.java.kv.LookupInResult
public class LookupInResult extends Object
This result is returned from successful KeyValue subdocument lookup responses.
- Since:
- 3.0.0
-
Method Summary
Modifier and Type Method Description long
cas()
Returns the CAS value of document at the time of loading.<T> T
contentAs(int index, TypeRef<T> target)
Decodes the content at the given index into an instance of the target type.<T> T
contentAs(int index, Class<T> target)
Decodes the content at the given index into an instance of the target class.JsonArray
contentAsArray(int index)
Decodes the encoded content at the given index into aJsonArray
.JsonObject
contentAsObject(int index)
Decodes the encoded content at the given index into aJsonObject
.boolean
equals(Object o)
boolean
exists(int index)
Allows to check if a value at the given index exists.int
hashCode()
boolean
isDeleted()
Returns whether this document was deleted (a tombstone).String
toString()
-
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.
-
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
-
equals
-
hashCode
public int hashCode()
-