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 Object implements DataHolder
  • Field Details

  • Constructor Details

    • DataSet

      public DataSet()
    • DataSet

      public DataSet(@Nullable @Nullable DataHolder other)
  • Method Details

    • aggregateActions

      @NotNull public static @NotNull DataHolder aggregateActions(@NotNull @NotNull DataHolder other, @NotNull @NotNull DataHolder overrides)
      aggregate actions of two data sets, actions not applied
      Parameters:
      other - first set of options
      overrides - overrides on options
      Returns:
      resulting options where aggregate action keys were aggregated but not applied
    • aggregate

      @NotNull public @NotNull DataHolder aggregate()
      Apply aggregate action to data and return result
      Returns:
      resulting data holder
    • aggregate

      @NotNull public static @NotNull DataHolder aggregate(@Nullable @Nullable DataHolder other, @Nullable @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 checked
      overrides - overrides which may contain aggregate actions
      Returns:
      resulting options with aggregate actions applied and removed from set
    • getAll

      @NotNull public @NotNull Map<? extends DataKeyBase<?>,Object> getAll()
      Specified by:
      getAll in interface DataHolder
    • getKeys

      @NotNull public @NotNull Collection<? extends DataKeyBase<?>> getKeys()
      Specified by:
      getKeys in interface DataHolder
    • contains

      public boolean contains(@NotNull @NotNull DataKeyBase<?> key)
      Specified by:
      contains in interface DataHolder
    • getOrCompute

      @Nullable public @Nullable Object getOrCompute(@NotNull @NotNull DataKeyBase<?> key, @NotNull @NotNull DataValueFactory<?> factory)
      Description copied from interface: DataHolder
      Get key if it exists or compute using supplier

      Method 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 interface DataHolder
      Parameters:
      key - data key
      factory - factory taking this data holder and computing/providing default value
      Returns:
      object value for the key
    • merge

      @NotNull public static @NotNull DataSet merge(@NotNull @NotNull DataHolder... dataHolders)
    • toMutable

      @NotNull public @NotNull MutableDataSet toMutable()
      Specified by:
      toMutable in interface DataHolder
    • toImmutable

      @NotNull public @NotNull DataSet toImmutable()
      Specified by:
      toImmutable in interface DataHolder
    • toDataSet

      @NotNull public @NotNull DataSet toDataSet()
      Specified by:
      toDataSet in interface DataHolder
    • registerDataKeyAggregator

      public static void registerDataKeyAggregator(@NotNull @NotNull DataKeyAggregator keyAggregator)
    • isAggregatorRegistered

      static boolean isAggregatorRegistered(@NotNull @NotNull DataKeyAggregator keyAggregator)
    • invokeSetContains

      static boolean invokeSetContains(@Nullable @Nullable Set<Class<?>> invokeSet, @NotNull @NotNull DataKeyAggregator aggregator)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object