Package com.couchbase.client.java.kv
Class GetResult
- java.lang.Object
-
- com.couchbase.client.java.kv.GetResult
-
public class GetResult extends Object
Returned from all kinds of KeyValue Get operation to fetch a document or a subset of it.- Since:
- 3.0.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
cas()
Returns the CAS value of the loaded document.<T> T
contentAs(Class<T> target)
Decodes the content of the document into a the target class using the default decoder.<T> T
contentAs(Class<T> target, Decoder<T> decoder)
Decodes the content of the document into a the target class using a custom decoder.JsonArray
contentAsArray()
Decodes the content of the document into aJsonArray
.JsonObject
contentAsObject()
Decodes the content of the document into aJsonObject
.boolean
equals(Object o)
Optional<Duration>
expiration()
If present, returns the expiration of the loaded document.int
hashCode()
String
toString()
-
-
-
Method Detail
-
cas
public long cas()
Returns the CAS value of the loaded document.
-
expiration
public Optional<Duration> expiration()
If present, returns the expiration of the loaded document.Note that the duration represents the time when the document has been loaded and can only ever be an approximation.
-
contentAsObject
public JsonObject contentAsObject()
Decodes the content of the document into aJsonObject
.
-
contentAsArray
public JsonArray contentAsArray()
Decodes the content of the document into aJsonArray
.
-
contentAs
public <T> T contentAs(Class<T> target)
Decodes the content of the document into a the target class using the default decoder.Note that while the decoder understands many types, if it fails to decode a certain POJO or custom decoding is needed use the
contentAs(Class, Decoder)
overload.- Parameters:
target
- the target class to decode the encoded content into.
-
contentAs
public <T> T contentAs(Class<T> target, Decoder<T> decoder)
Decodes the content of the document into a the target class using a custom decoder.- Parameters:
target
- the target class to decode the encoded content into.decoder
- the decoder that should be used to decode the content.
-
-