public class MetaData extends Object implements Map<String,Object>, Serializable
Constructor and Description |
---|
MetaData(Map<String,?> items)
Initializes a MetaData instance with the given
items as content. |
Modifier and Type | Method and Description |
---|---|
MetaData |
and(String key,
Object value)
Returns a MetaData instances containing the current entries, and the given
key and given
value . |
MetaData |
andIfNotPresent(String key,
Supplier<Object> value)
Returns a MetaData instances containing the current entries, and the given
key if it was
not yet present in this MetaData. |
void |
clear()
This operation is not supported.
|
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
static MetaData |
emptyInstance()
Returns an empty MetaData instance.
|
Set<Map.Entry<String,Object>> |
entrySet() |
boolean |
equals(Object o) |
static MetaData |
from(Map<String,?> metaDataEntries)
Creates a new MetaData instance from the given
metaDataEntries . |
Object |
get(Object key) |
int |
hashCode() |
boolean |
isEmpty() |
Set<String> |
keySet() |
MetaData |
mergedWith(Map<String,?> additionalEntries)
Returns a MetaData instance containing values of
this , combined with the given
additionalEntries . |
Object |
put(String key,
Object value)
This operation is not supported.
|
void |
putAll(Map<? extends String,?> m)
This operation is not supported.
|
protected Object |
readResolve()
Java Serialization specification method that will ensure that deserialization will maintain a single instance of
empty MetaData.
|
Object |
remove(Object key)
This operation is not supported.
|
int |
size() |
MetaData |
subset(String... keys)
Returns a MetaData instance containing a subset of the
keys in this instance. |
String |
toString() |
Collection<Object> |
values() |
static MetaData |
with(String key,
Object value)
Creates a MetaData instances with a single entry, with the given
key and
given value . |
MetaData |
withoutKeys(Set<String> keys)
Returns a MetaData instance with the items with given
keys removed. |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public MetaData(Map<String,?> items)
items
as content. Note that the items are copied
into the MetaData. Modifications in the Map of items will not reflect is the MetaData, or vice versa.
Modifications in the items themselves are reflected in the MetaData.items
- the items to populate the MetaData withpublic static MetaData emptyInstance()
public static MetaData from(Map<String,?> metaDataEntries)
metaDataEntries
. If metaDataEntries
is
already a MetaData instance, it is returned as is. This makes this method more suitable than the MetaData(java.util.Map)
copy-constructor.metaDataEntries
- the items to populate the MetaData withmetaDataEntries
as contentpublic static MetaData with(String key, Object value)
key
and
given value
.key
- The key for the entryvalue
- The value of the entrypublic MetaData and(String key, Object value)
key
and given
value
.
If key
already existed, it's old value
is overwritten with the given
value
.key
- The key for the entryvalue
- The value of the entrypublic MetaData andIfNotPresent(String key, Supplier<Object> value)
key
if it was
not yet present in this MetaData.
If key
already existed, the current value will be used.
Otherwise the Supplier function will provide the value
for key
key
- The key for the entryvalue
- A Supplier function which provides the valuepublic void clear()
public boolean containsKey(Object key)
containsKey
in interface Map<String,Object>
public boolean containsValue(Object value)
containsValue
in interface Map<String,Object>
public boolean equals(Object o)
public int hashCode()
public MetaData mergedWith(Map<String,?> additionalEntries)
this
, combined with the given
additionalEntries
. If any entries have identical keys, the values from the
additionalEntries
will take precedence.additionalEntries
- The additional entries for the new MetaDatathis
, combined with the given
additionalEntries
public MetaData withoutKeys(Set<String> keys)
keys
removed. Keys for which there is no
assigned value are ignored.keys
- The keys of the entries to removekeys
public MetaData subset(String... keys)
keys
in this instance.
Keys for which there is no assigned value are ignored.<keys
- The keys of the entries to removekeys
if these were already presentprotected Object readResolve()
Copyright © 2010–2020. All rights reserved.