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 I
Attempts to merge theValue.Immutable
s from thisDataHolder.Immutable
and the givenDataHolder.Immutable
to produce a new instance of the merged result.mergeWith
(I that, MergeFunction function) Attempts to merge theValue.Immutable
s from thisDataHolder.Immutable
and the givenDataHolder.Immutable
to produce a new instance of the merged result.Applies a transformation on the providedValue
such that the return value ofFunction.apply(Object)
will become the end resulting value set into the newly createdDataHolder.Immutable
.Applies a transformation on the providedValue
such that the return value ofFunction.apply(Object)
will become the end resulting value set into the newly createdDataHolder.Immutable
.Creates a newDataHolder.Immutable
with the provided value byKey
.Creates a newDataHolder.Immutable
with the provided value byKey
.Offers the givenvalue
as defined by the providedKey
such that if theKey
is supported, a newDataHolder.Immutable
is created.Creates a newDataHolder.Immutable
without the providedKey
.Creates a newDataHolder.Immutable
without the providedKey
.Creates a newDataHolder.Immutable
without the key of the providedValue
.
-
Method Details
-
transform
Applies a transformation on the providedValue
such 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 providedValue
such 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.Immutable
with 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.Immutable
with 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 givenvalue
as defined by the providedKey
such that if theKey
is supported, a newDataHolder.Immutable
is created.- Parameters:
value
- The value to set- Returns:
- The new immutable value store
-
without
Creates a newDataHolder.Immutable
without 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.Immutable
without 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.Immutable
without 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.Immutable
s from thisDataHolder.Immutable
and the givenDataHolder.Immutable
to 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.Immutable
s from thisDataHolder.Immutable
and the givenDataHolder.Immutable
to produce a new instance of the merged result. Any overlappingValueContainer
s 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
-