|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.basho.riak.client.bucket.DomainBucket<T>
public class DomainBucket<T>
A domain bucket is a wrapper around a Bucket that is strongly typed and uses
a preset ConflictResolver, MutationProducer, Converter, r, w, dw, rw, Retrier,
returnBody etc
If you are working with one specific type of data only it can be simpler to
create a DomainBucket around your bucket. It reduces the amount of
code since the Converter, Mutation, Retrier and
ConflictResolver are likely to be the same for each operation.
Example:
final Bucket b = client.createBucket(bucketName).allowSiblings(true).nVal(3).execute();
final DomainBucket
RiakBucket,
DomainBucketBuilder| Constructor Summary | |
|---|---|
DomainBucket(Bucket bucket,
ConflictResolver<T> resolver,
Converter<T> converter,
MutationProducer<T> mutationProducer,
StoreMeta storeMeta,
FetchMeta fetchMeta,
DeleteMeta deleteMeta,
Class<T> clazz,
Retrier retrier)
Create a new DomainBucket for clazz Class objects
wrapped around bucket
It is recommended to use the DomainBucketBuilder rather than this
constructor. |
|
| Method Summary | ||
|---|---|---|
static
|
builder(Bucket b,
Class<T> clazz)
Factory method to create a new DomainBucketBuilder for the given Bucket and Class. |
|
void |
delete(String key)
Delete the key/value stored at the key |
|
void |
delete(T o)
Delete the key/value stored at the key extracted from o's
RiakKey annotated field. |
|
T |
fetch(String key)
Fetch data stored at key in this bucket as an instance of
T. |
|
T |
fetch(T o)
Fetch data stored at the key extracted from o's
RiakKey annotated field as an instance of
T. |
|
T |
store(T o)
Store o in Riak. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DomainBucket(Bucket bucket,
ConflictResolver<T> resolver,
Converter<T> converter,
MutationProducer<T> mutationProducer,
StoreMeta storeMeta,
FetchMeta fetchMeta,
DeleteMeta deleteMeta,
Class<T> clazz,
Retrier retrier)
DomainBucket for clazz Class objects
wrapped around bucket
It is recommended to use the DomainBucketBuilder rather than this
constructor.
bucket - The bucket to wrap.resolver - the ConflictResolverconverter - the Converter to usemutationProducer - the MutationProducer to usestoreMeta - the set of store parametersfetchMeta - the set of fetch parametersdeleteMeta - the set of delete parametersclazz - the Class type of the DomainBucketretrier - the Retrier to use for each operation| Method Detail |
|---|
public T store(T o)
throws RiakException
o in Riak.
T must have a field annotated with RiakKey.
This is equivalent to creating and executing a StoreObject
operation with the Converter, ConflictResolver,
Retrier, and a Mutation (from calling
MutationProducer.produce(Object) on o), r, w, dw
etc. passed when the DomainBucket was constructed.
o - instance of T
RiakException
public T fetch(String key)
throws RiakException
key in this bucket as an instance of
T.
This is equivalent to creating and executing a FetchObject
configured with the Converter, ConflictResolver,
Retrier and r value specified in the constructor.
key -
RiakException
public T fetch(T o)
throws RiakException
o's
RiakKey annotated field as an instance of
T.
This is equivalent to creating and executing a FetchObject
configured with the Converter, ConflictResolver,
Retrier and r value specified in the constructor.
key -
RiakException
public void delete(T o)
throws RiakException
o's
RiakKey annotated field.
This is equivalent to creating and executing a DeleteObject
configured with the Retrier and r value specified in the
constructor.
key -
RiakException
public void delete(String key)
throws RiakException
key
This is equivalent to creating and executing a DeleteObject
configured with the Retrier and r value specified in the
constructor.
key -
RiakException
public static <T> DomainBucketBuilder<T> builder(Bucket b,
Class<T> clazz)
DomainBucketBuilder for the given Bucket and Class.
b - the Bucket to wrapclazz - the type of object to store/fetch with the new DomainBucket
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||