public interface Metadata
MetadataHolder
instance.Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears all key-value pairs from this
Metadata object. |
Metadata |
createStructure(java.lang.String key)
|
<T> com.google.common.base.Optional<T> |
get(java.lang.String key)
Gets the value assigned to the given key.
|
com.google.common.collect.ImmutableSet<java.lang.String> |
getAllKeys()
Returns an
ImmutableSet of all keys contained by this
Metadata objecjt. |
boolean |
has(java.lang.String key)
Returns whether the given key is defined for this
Metadata
object. |
boolean |
remove(java.lang.String key)
Removes the given key and its data from this
Metadata object. |
<T> void |
set(java.lang.String key,
T value)
Assigns the given value to the given key.
|
boolean has(java.lang.String key)
Metadata
object.key
- The key to checkMetadata
object<T> com.google.common.base.Optional<T> get(java.lang.String key) throws java.lang.ClassCastException
T
- The type of data associated with the given keykey
- The key of the value to retrieveOptional.absent()
if the key is not definedjava.lang.ClassCastException
- 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)<T> void set(java.lang.String key, T value)
T
- The type of data to be assignedkey
- The key to setvalue
- The value to assign to the keyMetadata createStructure(java.lang.String key) throws java.lang.IllegalArgumentException
Metadata
object as another
Metadata
instance and assigns it to the given key.key
- The key to assign the new structure toMetadata
objectjava.lang.IllegalArgumentException
- If a value is already assigned to the
given keyboolean remove(java.lang.String key)
Metadata
object.key
- The key to removetrue
if the key was removed; false
if
it was not present in this Metadata
objectcom.google.common.collect.ImmutableSet<java.lang.String> getAllKeys()
ImmutableSet
of all keys contained by this
Metadata
objecjt.ImmutableSet
of all keys contained by this
Metadata
objectvoid clear()
Metadata
object.