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 | Class and Description |
|---|---|
protected static class |
FetchValue.Response.Init<T extends FetchValue.Response.Init<T>> |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
Location |
getLocation()
Returns the
Location affected by the operation that resulted in this response. |
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(Converter<T> converter,
ConflictResolver<T> resolver)
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(Converter<T> converter)
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.
|
int |
hashCode() |
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.
|
String |
toString() |
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 Location getLocation()
Location affected by the operation that resulted in this response.Locationpublic 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,
Converterpublic <T> List<T> getValues(Converter<T> converter)
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 an object using the supplied
Converter rather than one
registered with the ConverterFactory.
converter - The converter to use.Converterpublic <T> T getValue(Converter<T> converter, ConflictResolver<T> resolver) throws UnresolvedConflictException
The values will be converted to objects using the supplied
Converter rather than one registered
with the ConverterFactory.
If there are multiple
values present (siblings), they will then be resolved using the supplied
ConflictResolver rather than one
registered with the ConflictResolverFactory.
converter - The converter to use.resolver - The conflict resolver to use.UnresolvedConflictException - if the resolver fails to resolve siblings.Converter,
ConflictResolverpublic <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.UnresolvedConflictExceptionConverterFactory,
Converter,
ConflictResolverFactory,
ConflictResolverpublic <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.UnresolvedConflictExceptionConverterFactory,
Converter,
ConflictResolverFactory,
ConflictResolverpublic <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,
ConverterCopyright © 2016. All rights reserved.