public abstract class DataKeyBase<T> extends Object implements MutableDataValueSetter<T>
| Constructor and Description |
|---|
DataKeyBase(@NotNull String name,
@NotNull DataKeyBase<T> defaultKey)
Creates a NullableDataKey with a dynamic default value taken from a value of another key
|
DataKeyBase(@NotNull String name,
T defaultValue) |
DataKeyBase(@NotNull String name,
T defaultValue,
@NotNull DataValueFactory<T> factory)
Creates a NullableDataKey with a computed default value and a provided default value when data holder is null.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o)
Compare only by address.
|
T |
get(@Nullable DataHolder holder) |
T |
getDefaultValue() |
T |
getDefaultValue(@NotNull DataHolder holder) |
@NotNull DataValueFactory<T> |
getFactory() |
T |
getFrom(@Nullable DataHolder holder)
Deprecated.
use get
|
@NotNull String |
getName() |
int |
hashCode() |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitsetpublic DataKeyBase(@NotNull
@NotNull String name,
T defaultValue,
@NotNull
@NotNull DataValueFactory<T> factory)
Use this constructor to ensure that factory is never called with null data holder value
name - See getName().defaultValue - default to use when data holder is nullfactory - data value factory for creating a new default value for the key for a non-null data holderpublic DataKeyBase(@NotNull
@NotNull String name,
@NotNull
@NotNull DataKeyBase<T> defaultKey)
does not cache the returned default value but will always delegate to another key until this key gets its own value set.
name - See getName().defaultKey - The NullableDataKey to take the default value from at time of construction.@NotNull public @NotNull String getName()
@NotNull public @NotNull DataValueFactory<T> getFactory()
public T getDefaultValue()
public T getDefaultValue(@NotNull @NotNull DataHolder holder)
public T get(@Nullable @Nullable DataHolder holder)
@Deprecated public final T getFrom(@Nullable @Nullable DataHolder holder)
holder - data holderpublic final boolean equals(Object o)
Copyright © 2020. All rights reserved.