public final class FetchValue extends GenericRiakCommand.GenericRiakCommandWithSameInfo<FetchValue.Response,Location,FetchOperation.Response>
Fetching an object from Riak is a simple matter of supplying a Location
and executing the FetchValue operation.
Namespace ns = new Namespace("my_type","my_bucket");
Location loc = new Location(ns, "my_key");
FetchValue fv = new FetchValue.Builder(loc).build();
FetchValue.Response response = client.execute(fv);
RiakObject obj = response.getValue(RiakObject.class);
All operations can called async as well.
...
RiakFuture<FetchValue.Response, Location> future = client.executeAsync(fv);
...
future.await();
if (future.isSuccess())
{
...
}
ORM features are also provided when retrieving the results from the response.
By default, JSON serialization / deserializtion is used. For example, if
the value stored in Riak was JSON and mapped to your class MyPojo
:
...
MyPojo mp = response.getValue(MyPojo.class);
...
FetchValue.Response
Modifier and Type | Class and Description |
---|---|
static class |
FetchValue.Builder
Used to construct a FetchValue command.
|
static class |
FetchValue.Option<T>
Options for controlling how Riak performs the fetch operation.
|
static class |
FetchValue.Response
A response from Riak containing results from a FetchValue command.
|
GenericRiakCommand.GenericRiakCommandWithSameInfo<R,I,CoreR>
Modifier and Type | Method and Description |
---|---|
protected FetchOperation |
buildCoreOperation() |
protected FetchValue.Response |
convertResponse(FutureOperation<FetchOperation.Response,?,Location> request,
FetchOperation.Response coreResponse) |
boolean |
equals(Object obj) |
protected RiakFuture<FetchValue.Response,Location> |
executeAsync(RiakCluster cluster) |
int |
hashCode() |
String |
toString() |
convertInfo
execute, execute
protected final RiakFuture<FetchValue.Response,Location> executeAsync(RiakCluster cluster)
executeAsync
in class GenericRiakCommand<FetchValue.Response,Location,FetchOperation.Response,Location>
protected FetchValue.Response convertResponse(FutureOperation<FetchOperation.Response,?,Location> request, FetchOperation.Response coreResponse)
convertResponse
in class GenericRiakCommand<FetchValue.Response,Location,FetchOperation.Response,Location>
protected FetchOperation buildCoreOperation()
buildCoreOperation
in class GenericRiakCommand<FetchValue.Response,Location,FetchOperation.Response,Location>
Copyright © 2016. All rights reserved.