Package com.vladsch.flexmark.util.data
Class MutableDataSet
- java.lang.Object
-
- com.vladsch.flexmark.util.data.DataSet
-
- com.vladsch.flexmark.util.data.MutableDataSet
-
- All Implemented Interfaces:
DataHolder,MutableDataHolder,MutableDataSetter
- Direct Known Subclasses:
MutableScopedDataSet
public class MutableDataSet extends DataSet implements MutableDataHolder
-
-
Field Summary
-
Fields inherited from interface com.vladsch.flexmark.util.data.DataHolder
NULL
-
-
Constructor Summary
Constructors Constructor Description MutableDataSet()MutableDataSet(@Nullable DataHolder other)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull MutableDataSetclear()clear all options out of the data set@Nullable ObjectgetOrCompute(@NotNull DataKeyBase<?> key, @NotNull DataValueFactory<?> factory)Get key if it exists or compute using supplierstatic MutableDataSetmerge(DataHolder... dataHolders)@NotNull MutableDataSetremove(@NotNull DataKeyBase<?> key)Remove the stored value for the key, used to force to default or to force recompute<T> @NotNull MutableDataSetset(@NotNull DataKey<T> key, T value)Store the given value for the key<T> @NotNull MutableDataSetset(@NotNull NullableDataKey<T> key, T value)Store the given value for the key@NotNull MutableDataSetsetAll(@NotNull DataHolder other)Copy all values from one data holder to this data holder@NotNull MutableDataSetsetFrom(@NotNull MutableDataSetter dataSetter)Store the given value for the key@NotNull MutableDataHoldersetIn(@NotNull MutableDataHolder dataHolder)Set options in given mutable data holder@NotNull MutableDataSettoDataSet()@NotNull DataSettoImmutable()@NotNull MutableDataSettoMutable()-
Methods inherited from class com.vladsch.flexmark.util.data.DataSet
aggregate, aggregate, aggregateActions, contains, equals, getAll, getKeys, hashCode, registerDataKeyAggregator, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.vladsch.flexmark.util.data.DataHolder
contains, getAll, getKeys
-
Methods inherited from interface com.vladsch.flexmark.util.data.MutableDataHolder
get
-
-
-
-
Constructor Detail
-
MutableDataSet
public MutableDataSet()
-
MutableDataSet
public MutableDataSet(@Nullable @Nullable DataHolder other)
-
-
Method Detail
-
set
@NotNull public <T> @NotNull MutableDataSet set(@NotNull @NotNull DataKey<T> key, @NotNull T value)
Description copied from interface:MutableDataHolderStore the given value for the key- Specified by:
setin interfaceMutableDataHolder- Type Parameters:
T- data type of the data referred by the key- Parameters:
key- data keyvalue- value to store- Returns:
- mutable data holder for chained calls
-
set
@NotNull public <T> @NotNull MutableDataSet set(@NotNull @NotNull NullableDataKey<T> key, @Nullable T value)
Description copied from interface:MutableDataHolderStore the given value for the key- Specified by:
setin interfaceMutableDataHolder- Type Parameters:
T- data type of the data referred by the key- Parameters:
key- data keyvalue- value to store- Returns:
- mutable data holder for chained calls
-
setFrom
@NotNull public @NotNull MutableDataSet setFrom(@NotNull @NotNull MutableDataSetter dataSetter)
Description copied from interface:MutableDataHolderStore the given value for the key- Specified by:
setFromin interfaceMutableDataHolder- Parameters:
dataSetter- data setter which will set values- Returns:
- mutable data holder for chained calls
-
setAll
@NotNull public @NotNull MutableDataSet setAll(@NotNull @NotNull DataHolder other)
Description copied from interface:MutableDataHolderCopy all values from one data holder to this data holder- Specified by:
setAllin interfaceMutableDataHolder- Parameters:
other- data holder from which to copy all values- Returns:
- mutable data holder for chained calls
-
merge
public static MutableDataSet merge(DataHolder... dataHolders)
-
setIn
@NotNull public @NotNull MutableDataHolder setIn(@NotNull @NotNull MutableDataHolder dataHolder)
Description copied from interface:MutableDataHolderSet options in given mutable data holder- Specified by:
setInin interfaceDataHolder- Specified by:
setInin interfaceMutableDataHolder- Specified by:
setInin interfaceMutableDataSetter- Parameters:
dataHolder- data holder where to copy options from this data holder- Returns:
- dataHolder
-
remove
@NotNull public @NotNull MutableDataSet remove(@NotNull @NotNull DataKeyBase<?> key)
Description copied from interface:MutableDataHolderRemove the stored value for the key, used to force to default or to force recompute- Specified by:
removein interfaceMutableDataHolder- Parameters:
key- data key to remove- Returns:
- mutable data holder for chained calls
-
getOrCompute
@Nullable public @Nullable Object getOrCompute(@NotNull @NotNull DataKeyBase<?> key, @NotNull @NotNull DataValueFactory<?> factory)
Description copied from interface:DataHolderGet key if it exists or compute using supplierMethod used by DataKey classes to access data.
NOTE: MutableDataHolders will compute an absent key and add it to its dataSet. DataHolders will return computed value but not change contained dataSet because they are immutable. So value will be computed every time it is requested.
- Specified by:
getOrComputein interfaceDataHolder- Specified by:
getOrComputein interfaceMutableDataHolder- Overrides:
getOrComputein classDataSet- Parameters:
key- data keyfactory- factory taking this data holder and computing/providing default value- Returns:
- object value for the key
-
toMutable
@NotNull public @NotNull MutableDataSet toMutable()
- Specified by:
toMutablein interfaceDataHolder- Overrides:
toMutablein classDataSet
-
toImmutable
@NotNull public @NotNull DataSet toImmutable()
- Specified by:
toImmutablein interfaceDataHolder- Overrides:
toImmutablein classDataSet
-
toDataSet
@NotNull public @NotNull MutableDataSet toDataSet()
- Specified by:
toDataSetin interfaceDataHolder- Overrides:
toDataSetin classDataSet
-
clear
@NotNull public @NotNull MutableDataSet clear()
Description copied from interface:MutableDataHolderclear all options out of the data set- Specified by:
clearin interfaceMutableDataHolder- Returns:
- mutable data holder for chained calls
-
-