public interface IRiakObject extends Iterable<RiakLink>
Although you can store your own Java Beans in Riak, this interface represents the core data type that is passed between the low and high level APIs and that all POJOs are converted to and from when stored or fetched.
Extends Iterable
to provide a simple way to iterate over the
collection of RiakLink
s.
NOTE: The name will be changing soon. The initial Java client release laid claim to the best name real estate. This class will be named RiakObject in subsequent releases.
Modifier and Type | Method and Description |
---|---|
IRiakObject |
addIndex(String index,
long value)
Add an int index to this objects indexes.
|
IRiakObject |
addIndex(String index,
String value)
Add a String index to this objects indexes.
|
IRiakObject |
addLink(RiakLink link)
Add link to this RiakObject's links.
|
IRiakObject |
addUsermeta(String key,
String value)
Adds the key, value to the collection of user meta data for this object.
|
Map<BinIndex,Set<String>> |
allBinIndexes()
Secondary indexes for this object.
|
Map<IntIndex,Set<Integer>> |
allIntIndexes()
Deprecated.
|
Map<IntIndex,Set<Long>> |
allIntIndexesV2()
Secondary indexes for this object.
|
Set<String> |
getBinIndex(String string)
Get a copy of the values for the given bin index
|
String |
getBucket()
The name of this objects bucket
|
String |
getContentType()
The content-type of this object's value.
|
Set<Integer> |
getIntIndex(String string)
Deprecated.
|
Set<Long> |
getIntIndexV2(String string)
Get a copy of the values for the given int_ index
|
String |
getKey()
The object's key.
|
Date |
getLastModified()
The last modified date as held by Riak.
|
List<RiakLink> |
getLinks()
A List of
RiakLink s from this object. |
Map<String,String> |
getMeta()
User meta data can be added to any Riak object.
|
String |
getUsermeta(String key)
Get the user meta data item for that key.
|
byte[] |
getValue()
The value.
|
String |
getValueAsString()
Convenience method.
|
VClock |
getVClock()
This objects Vector Clock.
|
String |
getVClockAsString()
String copy of this object's vector clock.
|
String |
getVtag()
If this object has a version tag (if it is one of a set of siblings)
|
boolean |
hasLink(RiakLink riakLink)
Does this object have that link?
|
boolean |
hasLinks()
Does this object link to any others?
|
boolean |
hasUsermeta()
Does this object have any user meta data?
|
boolean |
hasUsermeta(String key)
Does this object have a meta data item for that key?
|
boolean |
isDeleted()
Check to see if this object is a tombstone (deleted)
Note: The request has to have been made specifying tombstones
(deleted vclocks) are to be returned.
|
int |
numLinks()
How many
RiakLink s does this object have. |
IRiakObject |
removeBinIndex(String index)
Remove a
BinIndex from this RiakObject. |
IRiakObject |
removeIntIndex(String index)
Remove a
IntIndex from this RiakObject. |
IRiakObject |
removeLink(RiakLink link)
Remove a
RiakLink from this RiakObject. |
IRiakObject |
removeUsermeta(String key)
Remove that item of user meta data.
|
void |
setContentType(String contentType)
Set the content-type of this object's payload.
|
void |
setValue(byte[] value)
Set this IRiakObject's value.
|
void |
setValue(String value)
Convenience method that will result in value being turned into a byte[]
array using charset utf-8 and also will result in charset=utf-8 being
appended to the content-type for this object
|
Iterable<Map.Entry<String,String>> |
userMetaEntries()
An iterable view on the user meta entries.
|
String getBucket()
byte[] getValue()
String getValueAsString()
VClock getVClock()
VClock
for this object.String getVClockAsString()
String getKey()
String getVtag()
Date getLastModified()
String getContentType()
DefaultRiakObject.DEFAULT_CONTENT_TYPE
List<RiakLink> getLinks()
RiakLink
s from this object. See also Link Walking on the basho
site.boolean hasLinks()
int numLinks()
RiakLink
s does this object have.boolean hasLink(RiakLink riakLink)
Map<String,String> getMeta()
Map
of meta data for this object.boolean hasUsermeta()
boolean hasUsermeta(String key)
key
- String getUsermeta(String key)
key
- the name of the user meta data itemIterable<Map.Entry<String,String>> userMetaEntries()
Map.Entry
Map<BinIndex,Set<String>> allBinIndexes()
Set<String> getBinIndex(String string)
string
- the index name@Deprecated Map<IntIndex,Set<Integer>> allIntIndexes()
allIntIndexesV2()
Map<IntIndex,Set<Long>> allIntIndexesV2()
@Deprecated Set<Integer> getIntIndex(String string)
getIntIndexV2(java.lang.String)
Set<Long> getIntIndexV2(String string)
string
- the index namevoid setValue(byte[] value)
value
- the byte[] to set.void setValue(String value)
value
- the String valuevoid setContentType(String contentType)
contentType
- the content-type of this object's value (EG
text/plain;charset=utf-8)IRiakObject addLink(RiakLink link)
link
- a RiakLink
to add.IRiakObject removeLink(RiakLink link)
RiakLink
from this RiakObject.link
- the RiakLink
to removeIRiakObject addUsermeta(String key, String value)
key
- value
- IRiakObject removeUsermeta(String key)
key
- the key of the item to removeIRiakObject addIndex(String index, String value)
index
- index namevalue
- index valueIRiakObject addIndex(String index, long value)
index
- index namevalue
- index valueIRiakObject removeBinIndex(String index)
BinIndex
from this RiakObject.index
- the name of the bin index to removeIRiakObject removeIntIndex(String index)
IntIndex
from this RiakObject.index
- the name of the int index to removeboolean isDeleted()
com.basho.riak.client.operations.FetchObject#returnDeletedVClock(boolean)
,
com.basho.riak.client.operations.StoreObject#returnDeletedVClock(boolean)
Copyright © 2013. All Rights Reserved.