public class RiakUserMetadata extends Object
Arbitrary user metadata can be attached to an object in Riak. These are simply key/value pairs meaningful outside of the actual value of the object. This container allows the user to manipulate that data.
Data in Riak is character asSet agnostic; it's simply raw bytes. Methods are provided here
to either use your default character asSet or supply a specific one to convert to and
from String
s.
RiakObject.getUserMeta()
Constructor and Description |
---|
RiakUserMetadata() |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear all user metadata entries.
|
boolean |
containsKey(String key)
Determine if a specific usermeta entry is present.
|
boolean |
containsKey(String key,
Charset charset)
Determine if a specific usermeta entry is present.
|
boolean |
equals(Object o) |
BinaryValue |
get(BinaryValue key)
Get a user metadata entry.
|
String |
get(String key)
Get a user metadata entry.
|
String |
get(String key,
Charset charset)
Get a user metadata entry.
|
Set<Map.Entry<BinaryValue,BinaryValue>> |
getUserMetadata()
Get the user metadata entries
|
int |
hashCode() |
boolean |
isEmpty()
Determine if usermeta is present.
|
void |
put(BinaryValue key,
BinaryValue value)
Set a user metadata entry using raw bytes.
|
RiakUserMetadata |
put(Map<String,String> metaMap) |
void |
put(String key,
String value)
Set a user metadata entry.
|
void |
put(String key,
String value,
Charset charset)
Set a user metadata entry.
|
void |
remove(BinaryValue key) |
void |
remove(String key) |
void |
remove(String key,
Charset charset) |
int |
size()
Get the number of user metadata entries.
|
String |
toString() |
public boolean isEmpty()
true
if there are no entries, false
otherwise.public boolean containsKey(String key)
This method uses the default Charset
to convert the supplied key.
key
- the metadata keytrue
if the entry is present, false
otherwise.public boolean containsKey(String key, Charset charset)
This method uses the supplied Charset
to convert the supplied key.
key
- the metadata keytrue
if the entry is present, false
otherwise.public String get(String key)
This method and its put(java.lang.String, java.lang.String)
counterpart use the default Charset
to convert the String
s.
key
- the key for the user metadata entry as a String
encoded using the default Charset
String
using the default Charset
public String get(String key, Charset charset)
This method and its put(java.lang.String, java.lang.String, java.nio.charset.Charset)
counterpart use the supplied Charset
to convert the String
s.
key
- the key for the user metadata entry as a String
encoded using the supplied Charset
String
using the supplied Charset
public BinaryValue get(BinaryValue key)
This method and its
put(com.basho.riak.client.core.util.BinaryValue, com.basho.riak.client.core.util.BinaryValue)
allow access to the raw bytes.
key
- the key for the user metadata entrypublic Set<Map.Entry<BinaryValue,BinaryValue>> getUserMetadata()
This method allows access to the user metadata entries directly as raw bytes. The
Set
is an unmodifiable view of all the entries.
public void put(String key, String value)
This method and its get(java.lang.String)
counterpart use the default Charset
to convert the String
s.
key
- the key for the user metadata entry as a String
encoded using the default Charset
value
- the value for the entry as a String
encoded using the default Charset
public void put(String key, String value, Charset charset)
This method and its get(java.lang.String, java.nio.charset.Charset)
counterpart use the supplied Charset
to convert the String
s.
key
- the key for the user metadata entry as a String
encoded using the supplied Charset
value
- the value for the entry as a String
encoded using the supplied Charset
public void put(BinaryValue key, BinaryValue value)
This method and its get(com.basho.riak.client.core.util.BinaryValue)
counterpart all access to the user metadata raw bytes
key
- the key for the user metadata entryvalue
- the value for the entrypublic void remove(BinaryValue key)
public void remove(String key)
public RiakUserMetadata put(Map<String,String> metaMap)
public void clear()
public int size()
Copyright © 2016. All rights reserved.