public final class StoreValue extends GenericRiakCommand.GenericRiakCommandWithSameInfo<StoreValue.Response,Location,StoreOperation.Response>
To store a value in Riak you supply a Location
and an object to store. The object may be an instance of RiakObject
or your own POJO. In the case of a POJO the default serialization uses the Jackson JSON library
to store your object as JSON in Riak.
Namespace ns = new Namespace("my_type","my_bucket");
Location loc = new Location(ns, "my_key");
RiakObject ro = new RiakObject();
ro.setValue(BinaryValue.create("This is my value"));
StoreValue sv =
new StoreValue.Builder(ro).withLocation(loc).build();
StoreValue.Response response = client.execute(sv);
All operations can called async as well.
...
RiakFuture<StoreValue.Response, Location> future = client.executeAsync(sv);
...
future.await();
if (future.isSuccess())
{
...
}
Modifier and Type | Class and Description |
---|---|
static class |
StoreValue.Builder
Used to construct a StoreValue command.
|
static class |
StoreValue.Option<T>
Options For controlling how Riak performs the store operation.
|
static class |
StoreValue.Response |
GenericRiakCommand.GenericRiakCommandWithSameInfo<R,I,CoreR>
Modifier and Type | Method and Description |
---|---|
protected StoreOperation |
buildCoreOperation() |
protected StoreValue.Response |
convertResponse(FutureOperation<StoreOperation.Response,?,Location> request,
StoreOperation.Response coreResponse) |
boolean |
equals(Object obj) |
protected RiakFuture<StoreValue.Response,Location> |
executeAsync(RiakCluster cluster) |
int |
hashCode() |
String |
toString() |
convertInfo
execute, execute
protected StoreValue.Response convertResponse(FutureOperation<StoreOperation.Response,?,Location> request, StoreOperation.Response coreResponse)
convertResponse
in class GenericRiakCommand<StoreValue.Response,Location,StoreOperation.Response,Location>
protected RiakFuture<StoreValue.Response,Location> executeAsync(RiakCluster cluster)
executeAsync
in class GenericRiakCommand<StoreValue.Response,Location,StoreOperation.Response,Location>
protected StoreOperation buildCoreOperation()
buildCoreOperation
in class GenericRiakCommand<StoreValue.Response,Location,StoreOperation.Response,Location>
Copyright © 2016. All rights reserved.