public abstract class AbstractSpongeValueProcessor<E,V extends org.spongepowered.api.data.value.BaseValue<E>> extends Object implements ValueProcessor<E,V>
Modifier | Constructor and Description |
---|---|
protected |
AbstractSpongeValueProcessor(org.spongepowered.api.data.key.Key<V> key) |
Modifier and Type | Method and Description |
---|---|
protected abstract V |
constructValue(E defaultValue)
Builds a
Value of the type produced by this processor from an
input, actual value. |
Optional<V> |
getApiValueFromContainer(org.spongepowered.api.data.value.ValueContainer<?> container)
Gets the actual
Value object wrapping around the underlying value
desired from the provided ValueContainer . |
org.spongepowered.api.data.key.Key<? extends org.spongepowered.api.data.value.BaseValue<E>> |
getKey()
Gets the associated
Key that this ValueProcessor
will handle. |
int |
getPriority()
Gets the priority of this processor.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getValueFromContainer, offerToStore, removeFrom, supports
protected AbstractSpongeValueProcessor(org.spongepowered.api.data.key.Key<V> key)
protected abstract V constructValue(E defaultValue)
Value
of the type produced by this processor from an
input, actual value.defaultValue
- The actual valueValue
public final org.spongepowered.api.data.key.Key<? extends org.spongepowered.api.data.value.BaseValue<E>> getKey()
ValueProcessor
Key
that this ValueProcessor
will handle.getKey
in interface ValueProcessor<E,V extends org.spongepowered.api.data.value.BaseValue<E>>
public int getPriority()
ValueProcessor
Key
can have
multiple ValueProcessor
s such that mods introducing
changes to the game can provide their own ValueProcessor
s
for specific cases. The notion is that the higher the priority, the
earlier the processor is used. If for any reason a processor's method
is returning an Optional.absent()
or
DataTransactionResult
with a failure, the next processor in
line will be used. By default, all Sponge processors are with a
priority of 100.getPriority
in interface ValueProcessor<E,V extends org.spongepowered.api.data.value.BaseValue<E>>
public Optional<V> getApiValueFromContainer(org.spongepowered.api.data.value.ValueContainer<?> container)
ValueProcessor
Value
object wrapping around the underlying value
desired from the provided ValueContainer
. This is very similar to
ValueProcessor.getValueFromContainer(ValueContainer)
except that instead of an
actual value, a Value
or extension there of is returned.getApiValueFromContainer
in interface ValueProcessor<E,V extends org.spongepowered.api.data.value.BaseValue<E>>
container
- The container to get the API value fromValue
typed value