Package org.spongepowered.api.data
Interface DataHolder.Immutable<I extends DataHolder.Immutable<I>>
- All Superinterfaces:
DataHolder,ValueContainer
- All Known Subinterfaces:
BlockSnapshot,BlockState,BlockType,DirectionRelativeDataHolder.Immutable<I>,EntitySnapshot,FluidStackSnapshot,FluidState,FluidType,ItemStackSnapshot,ItemType,LocatableBlock,LocatableSnapshot<T>,SerializableDataHolder.Immutable<I>,State<S>
- Enclosing interface:
DataHolder
Represents a
DataHolder that is immutable and can be transformed
into other immutable data holders.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.spongepowered.api.data.DataHolder
DataHolder.Immutable<I extends DataHolder.Immutable<I>>, DataHolder.Mutable -
Method Summary
Modifier and TypeMethodDescriptiondefault IAttempts to merge theValue.Immutables from thisDataHolder.Immutableand the givenDataHolder.Immutableto produce a new instance of the merged result.mergeWith(I that, MergeFunction function) Attempts to merge theValue.Immutables from thisDataHolder.Immutableand the givenDataHolder.Immutableto produce a new instance of the merged result.Applies a transformation on the providedValuesuch that the return value ofFunction.apply(Object)will become the end resulting value set into the newly createdDataHolder.Immutable.Applies a transformation on the providedValuesuch that the return value ofFunction.apply(Object)will become the end resulting value set into the newly createdDataHolder.Immutable.Creates a newDataHolder.Immutablewith the provided value byKey.Creates a newDataHolder.Immutablewith the provided value byKey.Offers the givenvalueas defined by the providedKeysuch that if theKeyis supported, a newDataHolder.Immutableis created.Creates a newDataHolder.Immutablewithout the providedKey.Creates a newDataHolder.Immutablewithout the providedKey.Creates a newDataHolder.Immutablewithout the key of the providedValue.
-
Method Details
-
transform
Applies a transformation on the providedValuesuch that the return value ofFunction.apply(Object)will become the end resulting value set into the newly createdDataHolder.Immutable.- Type Parameters:
E- The type of value- Parameters:
key- The key linked tofunction- The function to manipulate the value- Returns:
- The newly created immutable value store
-
transform
default <E> Optional<I> transform(Supplier<? extends Key<? extends Value<E>>> key, Function<E, E> function) Applies a transformation on the providedValuesuch that the return value ofFunction.apply(Object)will become the end resulting value set into the newly createdDataHolder.Immutable.- Type Parameters:
E- The type of value- Parameters:
key- The key linked tofunction- The function to manipulate the value- Returns:
- The newly created immutable value store
-
with
Creates a newDataHolder.Immutablewith the provided value byKey. If the key is supported by this value store, the returned value store will be present.- Type Parameters:
E- The type of value- Parameters:
key- The key to the value to setvalue- The value to set- Returns:
- The new immutable value store
-
with
Creates a newDataHolder.Immutablewith the provided value byKey. If the key is supported by this value store, the returned value store will be present.- Type Parameters:
E- The type of value- Parameters:
key- The key to the value to setvalue- The value to set- Returns:
- The new immutable value store
-
with
Offers the givenvalueas defined by the providedKeysuch that if theKeyis supported, a newDataHolder.Immutableis created.- Parameters:
value- The value to set- Returns:
- The new immutable value store
-
without
Creates a newDataHolder.Immutablewithout the key of the providedValue. If the key is supported by this value store, the returned value store will be present.- Parameters:
value- The value- Returns:
- The new immutable value store
-
without
Creates a newDataHolder.Immutablewithout the providedKey. If the key is supported by this value store, the returned value store will be present.- Parameters:
key- The key to remove- Returns:
- The new immutable value store
-
without
Creates a newDataHolder.Immutablewithout the providedKey. If the key is supported by this value store, the returned value store will be present.- Parameters:
key- The key to remove- Returns:
- The new immutable value store
-
mergeWith
Attempts to merge theValue.Immutables from thisDataHolder.Immutableand the givenDataHolder.Immutableto produce a new instance of the merged result.- Parameters:
that- The other immutable value store to gather values from- Returns:
- The new immutable value store instance
-
mergeWith
Attempts to merge theValue.Immutables from thisDataHolder.Immutableand the givenDataHolder.Immutableto produce a new instance of the merged result. Any overlappingValueContainers are merged through theMergeFunction.- Parameters:
that- The other immutable value store to gather values fromfunction- The function to resolve merge conflicts- Returns:
- The new immutable value store instance
-