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(@Nullable DataHolder other)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull MutableDataSet
clear()
clear all options out of the data set@Nullable java.lang.Object
getOrCompute(@NotNull DataKeyBase<?> key, @NotNull DataValueFactory<?> factory)
Get key if it exists or compute using supplierstatic MutableDataSet
merge(DataHolder... dataHolders)
@NotNull MutableDataSet
remove(@NotNull DataKeyBase<?> key)
Remove the stored value for the key, used to force to default or to force recompute<T> @NotNull MutableDataSet
set(@NotNull DataKey<T> key, T value)
Store the given value for the keyprivate <T> MutableDataSet
set(@NotNull DataKeyBase<T> key, T value)
<T> @NotNull MutableDataSet
set(@NotNull NullableDataKey<T> key, T value)
Store the given value for the key@NotNull MutableDataSet
setAll(@NotNull DataHolder other)
Copy all values from one data holder to this data holder@NotNull MutableDataSet
setFrom(@NotNull MutableDataSetter dataSetter)
Store the given value for the key@NotNull MutableDataHolder
setIn(@NotNull MutableDataHolder dataHolder)
Set options in given mutable data holder@NotNull MutableDataSet
toDataSet()
@NotNull DataSet
toImmutable()
@NotNull MutableDataSet
toMutable()
-
Methods inherited from class com.vladsch.flexmark.util.data.DataSet
aggregate, aggregate, aggregateActions, contains, equals, getAll, getKeys, hashCode, invokeSetContains, isAggregatorRegistered, 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: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> @NotNull MutableDataSet set(@NotNull @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
-
set
private <T> MutableDataSet set(@NotNull @NotNull DataKeyBase<T> key, T value)
-
setFrom
@NotNull public @NotNull MutableDataSet setFrom(@NotNull @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 @NotNull MutableDataSet setAll(@NotNull @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 @NotNull MutableDataHolder setIn(@NotNull @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 @NotNull MutableDataSet remove(@NotNull @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 @Nullable java.lang.Object getOrCompute(@NotNull @NotNull DataKeyBase<?> key, @NotNull @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 @NotNull MutableDataSet toMutable()
- Specified by:
toMutable
in interfaceDataHolder
- Overrides:
toMutable
in classDataSet
-
toImmutable
@NotNull public @NotNull DataSet toImmutable()
- Specified by:
toImmutable
in interfaceDataHolder
- Overrides:
toImmutable
in classDataSet
-
toDataSet
@NotNull public @NotNull MutableDataSet toDataSet()
- Specified by:
toDataSet
in interfaceDataHolder
- Overrides:
toDataSet
in classDataSet
-
clear
@NotNull public @NotNull 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
-
-