public final class StructuredDataContainer
extends java.lang.Object
Constructor and Description |
---|
StructuredDataContainer() |
StructuredDataContainer(java.util.Map<StructuredDataKey<?>,StructuredData<?>> data) |
StructuredDataContainer(StructuredData<?>[] dataArray) |
Modifier and Type | Method and Description |
---|---|
void |
addEmpty(StructuredDataKey<?> key) |
<T> StructuredData<T> |
computeIfAbsent(StructuredDataKey<T> key,
java.util.function.Function<StructuredDataKey<T>,T> mappingFunction)
Returns structured data by id if not empty, or creates it.
|
boolean |
contains(StructuredDataKey<?> key) |
StructuredDataContainer |
copy() |
java.util.Map<StructuredDataKey<?>,StructuredData<?>> |
data() |
<T> @Nullable StructuredData<T> |
get(StructuredDataKey<T> key)
Returns structured data by id if present.
|
<T> @Nullable StructuredData<T> |
getNonEmpty(StructuredDataKey<T> key)
Returns structured data by id if not empty.
|
<T> @Nullable StructuredData<T> |
remove(StructuredDataKey<T> key)
Removes and returns structured data by the given key.
|
<T> void |
set(StructuredDataKey<T> key,
T value) |
void |
set(StructuredDataKey<Unit> key) |
void |
setIdLookup(Protocol<?,?,?,?> protocol,
boolean mappedNames)
Sets the lookup for serializer ids.
|
java.lang.String |
toString() |
public StructuredDataContainer(java.util.Map<StructuredDataKey<?>,StructuredData<?>> data)
public StructuredDataContainer(StructuredData<?>[] dataArray)
public StructuredDataContainer()
public <T> @Nullable StructuredData<T> get(StructuredDataKey<T> key)
T
- data typekey
- serializer idpublic <T> @Nullable StructuredData<T> getNonEmpty(StructuredDataKey<T> key)
T
- data typekey
- serializer idpublic <T> StructuredData<T> computeIfAbsent(StructuredDataKey<T> key, java.util.function.Function<StructuredDataKey<T>,T> mappingFunction)
T
- data typekey
- serializer idmappingFunction
- function to create structured data if not presentpublic <T> void set(StructuredDataKey<T> key, T value)
public void set(StructuredDataKey<Unit> key)
public void addEmpty(StructuredDataKey<?> key)
public <T> @Nullable StructuredData<T> remove(StructuredDataKey<T> key)
T
- data typekey
- serializer keypublic boolean contains(StructuredDataKey<?> key)
public void setIdLookup(Protocol<?,?,?,?> protocol, boolean mappedNames)
protocol
- protocol to retreive the id of the serializer frommappedNames
- if the names are mapped (true if structures from the mapped version are added, false for the unmapped version)public StructuredDataContainer copy()
public java.util.Map<StructuredDataKey<?>,StructuredData<?>> data()
public java.lang.String toString()
toString
in class java.lang.Object