Class NullableDataKey<T>
java.lang.Object
com.vladsch.flexmark.util.data.DataKeyBase<T>
com.vladsch.flexmark.util.data.NullableDataKey<T>
- All Implemented Interfaces:
MutableDataValueSetter<T>
-
Constructor Summary
ConstructorsConstructorDescriptionNullableDataKey(@NotNull String name) Create a DataKey with null default value and factory producing null valuesNullableDataKey(@NotNull String name, @NotNull DataKeyBase<T> defaultKey) Creates a NullableDataKey with a dynamic default value taken from a value of another keyNullableDataKey(@NotNull String name, @NotNull DataValueNullableFactory<T> factory) Creates a DataKey with a computed default value dynamically.NullableDataKey(@NotNull String name, @NotNull Supplier<T> supplier) Creates a DataKey with nullable data value and factory not dependent on data holderNullableDataKey(@NotNull String name, T defaultValue) NullableDataKey(@NotNull String name, T defaultValue, @NotNull DataValueFactory<T> factory) Creates a DataKey with nullable data value and factory with non-nullable dataHolder -
Method Summary
Modifier and TypeMethodDescriptionget(@Nullable DataHolder holder) getDefaultValue(@NotNull DataHolder holder) @NotNull MutableDataHolderset(@NotNull MutableDataHolder dataHolder, T value) toString()Methods inherited from class DataKeyBase
equals, getFactory, getFrom, getName, hashCode
-
Constructor Details
-
NullableDataKey
public NullableDataKey(@NotNull @NotNull String name, @Nullable T defaultValue, @NotNull @NotNull DataValueFactory<T> factory) Creates a DataKey with nullable data value and factory with non-nullable dataHolderUse this constructor to ensure that factory is never called with null data holder value
- Parameters:
name- SeeDataKeyBase.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 holder
-
NullableDataKey
public NullableDataKey(@NotNull @NotNull String name, @NotNull @NotNull DataValueNullableFactory<T> factory) Creates a DataKey with a computed default value dynamically.On construction will invoke factory with null data holder to get the default value
- Parameters:
name- SeeDataKeyBase.getName().factory- data value factory for creating a new default value for the key
-
NullableDataKey
Creates a DataKey with nullable data value and factory not dependent on data holderUse this constructor to ensure that factory is never called with null data holder value
- Parameters:
name- SeeDataKeyBase.getName().supplier- data value factory for creating a new default value for the key not dependent on dataHolder
-
NullableDataKey
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- SeeDataKeyBase.getName().defaultKey- The NullableDataKey to take the default value from at time of construction.
-
NullableDataKey
-
NullableDataKey
Create a DataKey with null default value and factory producing null values- Parameters:
name- key name
-
-
Method Details
-
getDefaultValue
- Overrides:
getDefaultValuein classDataKeyBase<T>
-
getDefaultValue
- Overrides:
getDefaultValuein classDataKeyBase<T>
-
get
- Overrides:
getin classDataKeyBase<T>
-
set
@NotNull public @NotNull MutableDataHolder set(@NotNull @NotNull MutableDataHolder dataHolder, @Nullable T value) -
toString
- Overrides:
toStringin classDataKeyBase<T>
-