Package com.vladsch.flexmark.util.data
Class DataKeyBase<T>
- java.lang.Object
-
- com.vladsch.flexmark.util.data.DataKeyBase<T>
-
- All Implemented Interfaces:
MutableDataValueSetter<T>
- Direct Known Subclasses:
DataKey,NullableDataKey
public abstract class DataKeyBase<T> extends Object implements MutableDataValueSetter<T>
-
-
Constructor Summary
Constructors Constructor Description DataKeyBase(@NotNull String name, @NotNull DataKeyBase<T> defaultKey)Creates a NullableDataKey with a dynamic default value taken from a value of another keyDataKeyBase(@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.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanequals(Object o)Compare only by address.Tget(@Nullable DataHolder holder)TgetDefaultValue()TgetDefaultValue(@NotNull DataHolder holder)@NotNull DataValueFactory<T>getFactory()TgetFrom(@Nullable DataHolder holder)Deprecated.use get@NotNull StringgetName()inthashCode()StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.vladsch.flexmark.util.data.MutableDataValueSetter
set
-
-
-
-
Constructor Detail
-
DataKeyBase
public DataKeyBase(@NotNull @NotNull String name, T defaultValue, @NotNull @NotNull DataValueFactory<T> factory)Creates a NullableDataKey with a computed default value and a provided default value when data holder is null.Use this constructor to ensure that factory is never called with null data holder value
- Parameters:
name- SeegetName().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 holder
-
DataKeyBase
public DataKeyBase(@NotNull @NotNull String name, @NotNull @NotNull DataKeyBase<T> defaultKey)Creates a NullableDataKey with a dynamic default value taken from a value of another keydoes not cache the returned default value but will always delegate to another key until this key gets its own value set.
- Parameters:
name- SeegetName().defaultKey- The NullableDataKey to take the default value from at time of construction.
-
-
Method Detail
-
getName
@NotNull public @NotNull String getName()
-
getFactory
@NotNull public @NotNull DataValueFactory<T> getFactory()
-
getDefaultValue
public T getDefaultValue()
-
getDefaultValue
public T getDefaultValue(@NotNull @NotNull DataHolder holder)
-
get
public T get(@Nullable @Nullable DataHolder holder)
-
getFrom
@Deprecated public final T getFrom(@Nullable @Nullable DataHolder holder)
Deprecated.use get- Parameters:
holder- data holder- Returns:
- return default value if holder is null, current value in holder or compute a new value
-
equals
public final boolean equals(Object o)
Compare only by address. Every key instance is unique
-
-