public final class FetchValue extends RiakCommand<FetchValue.Response,Location>
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.
|
Modifier and Type | Method and Description |
---|---|
protected RiakFuture<FetchValue.Response,Location> |
executeAsync(RiakCluster cluster) |
execute
protected final RiakFuture<FetchValue.Response,Location> executeAsync(RiakCluster cluster)
executeAsync
in class RiakCommand<FetchValue.Response,Location>
Copyright © 2014. All rights reserved.