Package com.vladsch.flexmark.util.data
Class DataSet
- java.lang.Object
-
- com.vladsch.flexmark.util.data.DataSet
-
- All Implemented Interfaces:
DataHolder
,MutableDataSetter
- Direct Known Subclasses:
MutableDataSet
,ScopedDataSet
public class DataSet extends java.lang.Object implements DataHolder
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.HashMap<DataKeyBase<?>,java.lang.Object>
dataSet
-
Fields inherited from interface com.vladsch.flexmark.util.data.DataHolder
NULL
-
-
Constructor Summary
Constructors Constructor Description DataSet()
DataSet(DataHolder other)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DataHolder
aggregate()
Apply aggregate action to data and return resultstatic DataHolder
aggregate(DataHolder other, DataHolder overrides)
Aggregate two sets of options by aggregating their aggregate action keys then applying those actions on the resulting collectionstatic DataHolder
aggregateActions(DataHolder other, DataHolder overrides)
aggregate actions of two data sets, actions not appliedboolean
contains(DataKeyBase<?> key)
boolean
equals(java.lang.Object o)
java.util.Map<? extends DataKeyBase<?>,java.lang.Object>
getAll()
java.util.Collection<? extends DataKeyBase<?>>
getKeys()
java.lang.Object
getOrCompute(DataKeyBase<?> key, DataValueFactory<?> factory)
Get key if it exists or compute using supplierint
hashCode()
static DataSet
merge(DataHolder... dataHolders)
static void
registerDataKeyAggregator(DataKeyAggregator keyAggregator)
DataSet
toDataSet()
DataSet
toImmutable()
MutableDataSet
toMutable()
java.lang.String
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
get, setIn
-
-
-
-
Field Detail
-
dataSet
protected final java.util.HashMap<DataKeyBase<?>,java.lang.Object> dataSet
-
-
Constructor Detail
-
DataSet
public DataSet()
-
DataSet
public DataSet(@Nullable DataHolder other)
-
-
Method Detail
-
aggregateActions
@NotNull public static DataHolder aggregateActions(@NotNull DataHolder other, @NotNull DataHolder overrides)
aggregate actions of two data sets, actions not applied- Parameters:
other
- first set of optionsoverrides
- overrides on options- Returns:
- resulting options where aggregate action keys were aggregated but not applied
-
aggregate
@NotNull public DataHolder aggregate()
Apply aggregate action to data and return result- Returns:
- resulting data holder
-
aggregate
@NotNull public static DataHolder aggregate(@Nullable DataHolder other, @Nullable DataHolder overrides)
Aggregate two sets of options by aggregating their aggregate action keys then applying those actions on the resulting collection- Parameters:
other
- options with aggregate actions already applied, no aggregate action keys are expected or checkedoverrides
- overrides which may contain aggregate actions- Returns:
- resulting options with aggregate actions applied and removed from set
-
getAll
@NotNull public java.util.Map<? extends DataKeyBase<?>,java.lang.Object> getAll()
- Specified by:
getAll
in interfaceDataHolder
-
getKeys
@NotNull public java.util.Collection<? extends DataKeyBase<?>> getKeys()
- Specified by:
getKeys
in interfaceDataHolder
-
contains
public boolean contains(@NotNull DataKeyBase<?> key)
- Specified by:
contains
in interfaceDataHolder
-
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
- Parameters:
key
- data keyfactory
- factory taking this data holder and computing/providing default value- Returns:
- object value for the key
-
merge
@NotNull public static DataSet merge(@NotNull DataHolder... dataHolders)
-
toMutable
@NotNull public MutableDataSet toMutable()
- Specified by:
toMutable
in interfaceDataHolder
-
toImmutable
@NotNull public DataSet toImmutable()
- Specified by:
toImmutable
in interfaceDataHolder
-
toDataSet
@NotNull public DataSet toDataSet()
- Specified by:
toDataSet
in interfaceDataHolder
-
registerDataKeyAggregator
public static void registerDataKeyAggregator(@NotNull DataKeyAggregator keyAggregator)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-