Package com.couchbase.client.java.kv
Class ScanResult
java.lang.Object
com.couchbase.client.java.kv.ScanResult
Returned for each found item in a KV Range Scan operation.
- 
Constructor SummaryConstructorsConstructorDescriptionScanResult(boolean idOnly, String id, byte[] content, int flags, long cas, Optional<Instant> expiry, Transcoder transcoder) Creates a newGetResult.
- 
Method SummaryModifier and TypeMethodDescriptionlongcas()Returns the CAS value of document at the time of loading.<T> TDecodes the content of the document into an instance of the target type.<T> TDecodes the content of the document into an instance of the target class.Decodes the content of the document into aJsonArray.byte[]Returns the raw bytes of the document content.Decodes the content of the document into aJsonObject.booleanIf the document has an expiry, returns the point in time when the loaded document expires.inthashCode()id()Returns the ID of the document.booleanidOnly()Returns true if this result came from a scan whereScanOptions.idsOnly(boolean)was set to true.toString()
- 
Constructor Details
- 
Method Details- 
idReturns the ID of the document.- Returns:
- the ID of the document.
 
- 
idOnlypublic boolean idOnly()Returns true if this result came from a scan whereScanOptions.idsOnly(boolean)was set to true.If true, attempting to access the document content or metadata will throw UnsupportedOperationException.
- 
caspublic 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.- Throws:
- NoSuchElementException- if this result came from a scan where- ScanOptions.idsOnly(boolean)was set to true. See- idOnly().
 
- 
expiryTimeIf the document has an expiry, returns the point in time when the loaded document expires.- Throws:
- NoSuchElementException- if this result came from a scan where- ScanOptions.idsOnly(boolean)was set to true. See- idOnly().
 
- 
contentAsObjectDecodes the content of the document into aJsonObject.- Throws:
- NoSuchElementException- if this result came from a scan where- ScanOptions.idsOnly(boolean)was set to true. See- idOnly().
 
- 
contentAsArrayDecodes the content of the document into aJsonArray.- Throws:
- NoSuchElementException- if this result came from a scan where- ScanOptions.idsOnly(boolean)was set to true. See- idOnly().
 
- 
contentAsDecodes the content of the document into an instance of the target class.- Parameters:
- target- the target class to decode the encoded content into.
- Throws:
- NoSuchElementException- if this result came from a scan where- ScanOptions.idsOnly(boolean)was set to true. See- idOnly().
 
- 
contentAsDecodes the content of the document into an instance of the target type. Example usage:List<String> strings = result.contentAs(new TypeRef<List<String>>(){});- Parameters:
- target- the type to decode the encoded content into.
- Throws:
- NoSuchElementException- if this result came from a scan where- ScanOptions.idsOnly(boolean)was set to true. See- idOnly().
 
- 
contentAsBytespublic byte[] contentAsBytes()Returns the raw bytes of the document content.- Returns:
- the document content as a byte array
- Throws:
- NoSuchElementException- if this result came from a scan where- ScanOptions.idsOnly(boolean)was set to true. See- idOnly().
 
- 
toString
- 
equals
- 
hashCodepublic int hashCode()
 
-