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:
BuilderBase
,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(DataHolder other)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MutableDataSet
clear()
clear all options out of the data setjava.lang.Object
getOrCompute(DataKeyBase<?> key, DataValueFactory<?> factory)
Get key if it exists or compute using supplierstatic MutableDataSet
merge(DataHolder... dataHolders)
MutableDataSet
remove(DataKeyBase<?> key)
Remove the stored value for the key, used to force to default or to force recompute<T> MutableDataSet
set(DataKey<T> key, T value)
Store the given value for the key<T> MutableDataSet
set(NullableDataKey<T> key, T value)
Store the given value for the keyMutableDataSet
setAll(DataHolder other)
Copy all values from one data holder to this data holderMutableDataSet
setFrom(MutableDataSetter dataSetter)
Store the given value for the keyMutableDataHolder
setIn(MutableDataHolder dataHolder)
Set options in given mutable data holderMutableDataSet
toDataSet()
DataSet
toImmutable()
MutableDataSet
toMutable()
-
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 DataHolder other)
-
-
Method Detail
-
set
@NotNull public <T> MutableDataSet set(@NotNull DataKey<T> key, @NotNull T value)
Description copied from interface:MutableDataHolder
Store the given value for the key- Specified by:
set
in 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> MutableDataSet set(@NotNull NullableDataKey<T> key, @Nullable T value)
Description copied from interface:MutableDataHolder
Store the given value for the key- Specified by:
set
in 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 MutableDataSet setFrom(@NotNull MutableDataSetter dataSetter)
Description copied from interface:MutableDataHolder
Store the given value for the key- Specified by:
setFrom
in interfaceMutableDataHolder
- Parameters:
dataSetter
- data setter which will set values- Returns:
- mutable data holder for chained calls
-
setAll
@NotNull public MutableDataSet setAll(@NotNull DataHolder other)
Description copied from interface:MutableDataHolder
Copy all values from one data holder to this data holder- Specified by:
setAll
in 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 MutableDataHolder setIn(@NotNull MutableDataHolder dataHolder)
Description copied from interface:MutableDataHolder
Set options in given mutable data holder- Specified by:
setIn
in interfaceDataHolder
- Specified by:
setIn
in interfaceMutableDataHolder
- Specified by:
setIn
in interfaceMutableDataSetter
- Parameters:
dataHolder
- data holder where to copy options from this data holder- Returns:
- dataHolder
-
remove
@NotNull public MutableDataSet remove(@NotNull DataKeyBase<?> key)
Description copied from interface:MutableDataHolder
Remove the stored value for the key, used to force to default or to force recompute- Specified by:
remove
in interfaceMutableDataHolder
- Parameters:
key
- data key to remove- Returns:
- mutable data holder for chained calls
-
getOrCompute
@Nullable public java.lang.Object getOrCompute(@NotNull DataKeyBase<?> key, @NotNull DataValueFactory<?> factory)
Description copied from interface:DataHolder
Get 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:
getOrCompute
in interfaceDataHolder
- Specified by:
getOrCompute
in interfaceMutableDataHolder
- Overrides:
getOrCompute
in classDataSet
- Parameters:
key
- data keyfactory
- factory taking this data holder and computing/providing default value- Returns:
- object value for the key
-
toMutable
@NotNull public MutableDataSet toMutable()
- Specified by:
toMutable
in interfaceDataHolder
- Overrides:
toMutable
in classDataSet
-
toImmutable
@NotNull public DataSet toImmutable()
- Specified by:
toImmutable
in interfaceDataHolder
- Overrides:
toImmutable
in classDataSet
-
toDataSet
@NotNull public MutableDataSet toDataSet()
- Specified by:
toDataSet
in interfaceDataHolder
- Overrides:
toDataSet
in classDataSet
-
clear
@NotNull public MutableDataSet clear()
Description copied from interface:MutableDataHolder
clear all options out of the data set- Specified by:
clear
in interfaceMutableDataHolder
- Returns:
- mutable data holder for chained calls
-
-