public static class FetchValue.Response extends Object
The Response, unless marked not found or unchanged, will contain one or more objects returned from Riak (all siblings are returned if present).
Modifier and Type | Method and Description |
---|---|
int |
getNumberOfValues()
Return the number of values contained in this response.
|
<T> T |
getValue(Class<T> clazz)
Get a single, resolved object from this response.
|
<T> T |
getValue(com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
Get a single, resolved object from this response.
|
List<RiakObject> |
getValues()
Get all the objects returned in this response.
|
<T> List<T> |
getValues(Class<T> clazz)
Get all the objects returned in this response.
|
<T> List<T> |
getValues(com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
Get the objects returned in this response.
|
VClock |
getVectorClock()
Get the vector clock returned with this response.
|
boolean |
hasValues()
Determine if this response contains any returned values.
|
boolean |
isNotFound()
Determine if there was a value in Riak.
|
boolean |
isUnchanged()
Determine if the value is unchanged.
|
public boolean isNotFound()
If there was no value present at the supplied Location
in
Riak, this will be true.
public boolean isUnchanged()
FetchValue.Option.IF_MODIFIED
this indicates if the value in Riak has been modified.
public boolean hasValues()
public int getNumberOfValues()
If siblings are present at the Location
, all values
are returned.
public List<RiakObject> getValues()
If siblings were present in Riak for the object you were fetching, this method will return all of them to you.
public VClock getVectorClock()
When storing/retrieving core Java types (HashMap
,
ArrayList
,String
, etc) or non-annotated POJOs
this method allows you to retrieve the vector clock.
public <T> List<T> getValues(Class<T> clazz)
If siblings were present in Riak for the object you were fetching, this method will return all of them to you.
The values will be converted to the supplied class using the
Converter
returned from the ConverterFactory
.
By default this will be the JSONConverter
,
or no conversion at all if you pass in RiakObject.class
.
clazz
- the class to be converted toConverterFactory
,
Converter
public <T> T getValue(Class<T> clazz) throws UnresolvedConflictException
The values will be converted to the supplied class using the
Converter
returned from the ConverterFactory
.
By default this will be the JSONConverter
,
or no conversion at all if you pass in RiakObject.class
. If there are multiple
values present (siblings), they will then be resolved using the
ConflictResolver
returned by the ConflictResolverFactory
.
clazz
- the class to be converted to.UnresolvedConflictException
ConverterFactory
,
Converter
,
ConflictResolverFactory
,
ConflictResolver
public <T> T getValue(com.fasterxml.jackson.core.type.TypeReference<T> typeReference) throws UnresolvedConflictException
The values will be converted to the supplied class using the
Converter
returned from the ConverterFactory
.
By default this will be the JSONConverter
,
or no conversion at all if you pass in RiakObject.class
. If there are multiple
values present (siblings), they will then be resolved using the
ConflictResolver
returned by the ConflictResolverFactory
.
This version should only be used if you're converting to a parameterized generic domain object. For example:
TypeReference<MyPojo<String>> tr = new TypeReference<MyPojo<String>>(){}; MyPojo<String> myPojo = response.getValue(tr);
typeReference
- The TypeReference of the class to be converted to.UnresolvedConflictException
ConverterFactory
,
Converter
,
ConflictResolverFactory
,
ConflictResolver
public <T> List<T> getValues(com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
If siblings were present in Riak for the object you were fetching, this method will return all of them to you.
The values will be converted to the supplied class using the
Converter
returned from the ConverterFactory
.
By default this will be the JSONConverter
,
or no conversion at all if you pass in a TypeReference for RiakObject.class
.
This version should only be used if you're converting to a parameterized generic domain object. For example:
TypeReference<MyPojo<String>> tr = new TypeReference<MyPojo<String>>(){}; List<MyPojo<String>> list = response.getValues(tr);
typeReference
- the TypeReference for the class to be converted toConverterFactory
,
Converter
Copyright © 2014. All rights reserved.