com.basho.riak.client.raw
Class RiakResponse

java.lang.Object
  extended by com.basho.riak.client.raw.RiakResponse
All Implemented Interfaces:
Iterable<IRiakObject>

public class RiakResponse
extends Object
implements Iterable<IRiakObject>

A data response from Riak separated into a single vector clock and an array of sibling values. Immutable

Author:
russell

Constructor Summary
RiakResponse(byte[] vclock)
          Create a response from the given vector clock.
RiakResponse(byte[] vclock, IRiakObject[] riakObjects)
          Create a response from the given vector clock and array.
 
Method Summary
static RiakResponse empty()
          Generate the empty response
static RiakResponse empty(boolean unmodified)
          Generate an empty response, with a value for the conditional get 'isUnmodified' response.
 IRiakObject[] getRiakObjects()
          Gets the actual array of IRiakObject (not a clone or copy, so treat it well)
 VClock getVclock()
          Get the vector clock as a VClock
 byte[] getVclockBytes()
          Get the vector clock bytes
 boolean hasSiblings()
          Does the response have sibling values?
 boolean hasValue()
          Does the response hav *any* values?
 boolean isDeleted()
           
 boolean isUnmodified()
           
 Iterator<IRiakObject> iterator()
          Unmodifiable iterator view of the values returned from Riak.
static RiakResponse matchFound()
           
 int numberOfValues()
          How many values?
static RiakResponse unmodified()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RiakResponse

public RiakResponse(byte[] vclock,
                    IRiakObject[] riakObjects)
Create a response from the given vector clock and array. Array maybe empty or null as may the vector clock (which implies no data, right.)

Parameters:
vclock -
riakObjects -

RiakResponse

public RiakResponse(byte[] vclock)
Create a response from the given vector clock. Vclock may not be null. This response is a fetch response where the vclock was returned but the item is deleted.

Parameters:
vclock -
Method Detail

getVclockBytes

public byte[] getVclockBytes()
Get the vector clock bytes

Returns:
the vclock

getVclock

public VClock getVclock()
Get the vector clock as a VClock

Returns:
the vector clock

getRiakObjects

public IRiakObject[] getRiakObjects()
Gets the actual array of IRiakObject (not a clone or copy, so treat it well)

Returns:
the riakObjects

hasSiblings

public boolean hasSiblings()
Does the response have sibling values?

Returns:

hasValue

public boolean hasValue()
Does the response hav *any* values?

Returns:

numberOfValues

public int numberOfValues()
How many values?

Returns:

isUnmodified

public boolean isUnmodified()
Returns:
true if this is an empty response because of a conditional fetch that returned unchanged/not-modified
See Also:
FetchObject.ifModified(VClock), FetchObject.modifiedSince(java.util.Date), FetchMeta.getIfModifiedSince(), FetchMeta.getIfModifiedVClock()

isDeleted

public boolean isDeleted()
Returns:
true if this object has been deleted but there is a vclock for it, only relevant/accurate if the fetch asked for the deleted vclock.
See Also:
FetchObject.returnDeletedVClock(boolean), FetchMeta.getReturnDeletedVClock()

iterator

public Iterator<IRiakObject> iterator()
Unmodifiable iterator view of the values returned from Riak.

Specified by:
iterator in interface Iterable<IRiakObject>

empty

public static RiakResponse empty()
Generate the empty response

Returns:
THE empty response

empty

public static RiakResponse empty(boolean unmodified)
Generate an empty response, with a value for the conditional get 'isUnmodified' response.

Returns:
THE empty response

unmodified

public static RiakResponse unmodified()
Parameters:
unmodified -
Returns:
an empty response for an unmodified object (from a conditional fetch).

matchFound

public static RiakResponse matchFound()
Returns:


Copyright © 2012. All Rights Reserved.