public interface PersistentMetadata extends Metadata
PersistentMetadataHolder
instance or a parent
PersistentMetadata
object.Modifier and Type | Method and Description |
---|---|
PersistentMetadata |
createStructure(String key)
Creates a structure within this
PersistentMetadata object as
another PersistentMetadata instance and assigns it to the given
key. |
<T> T |
get(String key,
Serializer<T> serializer)
Gets the value assigned to the given key.
|
void |
set(String key,
boolean value)
Assigns the given boolean to the given key in a persistent manner.
|
void |
set(String key,
byte value)
Assigns the given byte to the given key in a persistent manner.
|
void |
set(String key,
char value)
Assigns the given char to the given key in a persistent manner.
|
void |
set(String key,
double value)
Assigns the given double to the given key in a persistent manner.
|
void |
set(String key,
float value)
Assigns the given float to the given key in a persistent manner.
|
void |
set(String key,
int value)
Assigns the given int to the given key in a persistent manner.
|
void |
set(String key,
List<String> value)
Assigns the given string
List to the given key in a persistent
manner. |
<T> void |
set(String key,
List<T> value,
Serializer<T> serializer)
Assigns the given
List to the given key in a persistent
manner, using the provided Serializer to serialize its respective
values to strings. |
void |
set(String key,
long value)
Assigns the given long to the given key in a persistent manner.
|
void |
set(String key,
Object value)
Assigns the given value to the given key.
|
void |
set(String key,
short value)
Assigns the given short to the given key in a persistent manner.
|
void |
set(String key,
String value)
Assigns the given string to the given key in a persistent manner.
|
<T> void |
set(String key,
T value,
Serializer<T> serializer)
Assigns the given object to the given key in a persistent manner, using
the provided
Serializer to serialize it to a string. |
<T> T get(String key, Serializer<T> serializer) throws ClassCastException, IllegalArgumentException
T
- The type of data associated with the given keykey
- The key of the value to retrieveserializer
- The Serializer
to apply to the retrieved valueOptional.absent()
if the key is not definedClassCastException
- If the value associated with the given key is
assignable from the generic parameter type T
(Note that
this exception is not thrown by this method directly, but rather by
the JVM upon its invocation)IllegalArgumentException
- If the value associated with
key
is a PersistentMetadata
structure, or if
the value is an invalid serial for the provided Serializer
void set(String key, Object value) throws UnsupportedOperationException
This method is not supported for PersistentMetadata
objects.
set
in interface Metadata
key
- The key to setvalue
- The value to assign to the keyUnsupportedOperationException
- Alwaysvoid set(String key, String value)
key
- The key to setvalue
- The string to assign to the keyvoid set(String key, boolean value)
key
- The key to setvalue
- The boolean to assign to the keyvoid set(String key, byte value)
key
- The key to setvalue
- The byte to assign to the keyvoid set(String key, short value)
key
- The key to setvalue
- The short to assign to the keyvoid set(String key, char value)
key
- The key to setvalue
- The char to assign to the keyvoid set(String key, int value)
key
- The key to setvalue
- The int to assign to the keyvoid set(String key, long value)
key
- The key to setvalue
- The long to assign to the keyvoid set(String key, float value)
key
- The key to setvalue
- The float to assign to the keyvoid set(String key, double value)
key
- The key to setvalue
- The double to assign to the key<T> void set(String key, T value, Serializer<T> serializer)
Serializer
to serialize it to a string.T
- The object type accepted by serializer
key
- The key to setvalue
- The object to assign to the keyserializer
- The Serializer
to apply to the provided valuevoid set(String key, List<String> value)
List
to the given key in a persistent
manner.key
- The key to setvalue
- The string List
to assign to the key<T> void set(String key, List<T> value, Serializer<T> serializer)
List
to the given key in a persistent
manner, using the provided Serializer
to serialize its respective
values to strings.T
- The object type accepted by serializer
key
- The key to setvalue
- The List
to assign to the keyserializer
- The Serializer
to apply to the provided list's
elementsPersistentMetadata createStructure(String key)
PersistentMetadata
object as
another PersistentMetadata
instance and assigns it to the given
key.createStructure
in interface Metadata
key
- The key to assign the new structure toPersistentMetadata
object