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 booleanCheck if the provided component patch is empty.static voidsetValue(Object patch, it.unimi.dsi.fastutil.objects.Reference2ObjectMap<Object, Optional<?>> value) Replace the map value into component patch.static intGet 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
-
entrySet
-
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.
-