Package com.saicone.rtag.data
Class DataComponent.Patch
java.lang.Object
com.saicone.rtag.data.DataComponent.Patch
- Enclosing class:
- DataComponent
Class to invoke methods from DataComponentPatch.
Instead of patched map, a component patch acts like a cloneable object that can be introduced into maps and also hold empty values to future deletion.
Instead of patched map, a component patch acts like a cloneable object that can be introduced into maps and also hold empty values to future deletion.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic DataComponent.Builder<Optional<?>>
builder()
Create a DataComponentPatch builder to set values and then wrap into component patch.Get a DataComponentType key set from component patch.Get a declared component type from provided component patch.Get the map value from component patch.static boolean
Check if the provided component patch is empty.static void
Replace the map value into component patch.static int
Get the size of provided component patch.
-
Field Details
-
EMPTY
An empty DataComponentPatch instance.
-
-
Method Details
-
builder
Create a DataComponentPatch builder to set values and then wrap into component patch.- Returns:
- a newly generated builder to edit.
-
get
Get a declared component type from provided component patch.- Parameters:
patch
- the component patch to get component from.type
- the DataComponentType instance that declares a component type.- Returns:
- the component declared type from data component cache wrapped into optional object.
-
getValue
public static it.unimi.dsi.fastutil.objects.Reference2ObjectMap<Object,Optional<?>> getValue(Object patch) Get the map value from component patch.- Parameters:
patch
- the patch to get the value itself.- Returns:
- a Reference2ObjectMap inside component patch.
-
entrySet
Get a DataComponentType key set from component patch.- Parameters:
patch
- the patch to get the key set.- Returns:
- set full of DataComponentType objects.
-
size
Get the size of provided component patch.- Parameters:
patch
- the component patch to get size.- Returns:
- the number of data type elements in provided component patch.
-
isEmpty
Check if the provided component patch is empty.- Parameters:
patch
- the component patch to check.- Returns:
- true if the component patch has no elements.
-
setValue
public static void setValue(Object patch, it.unimi.dsi.fastutil.objects.Reference2ObjectMap<Object, Optional<?>> value) Replace the map value into component patch.- Parameters:
patch
- the component patch to set the map value.value
- a Reference2ObjectMap with DataComponentType as keys and wrapped declared objects has values.
-