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
  • Constructor Details

    • MutableDataSet

      public MutableDataSet()
    • MutableDataSet

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

    • 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 interface MutableDataHolder
      Type Parameters:
      T - data type of the data referred by the key
      Parameters:
      key - data key
      value - 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 interface MutableDataHolder
      Type Parameters:
      T - data type of the data referred by the key
      Parameters:
      key - data key
      value - 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 interface MutableDataHolder
      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 interface MutableDataHolder
      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 interface DataHolder
      Specified by:
      setIn in interface MutableDataHolder
      Specified by:
      setIn in interface MutableDataSetter
      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 interface MutableDataHolder
      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: 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
      Specified by:
      getOrCompute in interface MutableDataHolder
      Overrides:
      getOrCompute in class DataSet
      Parameters:
      key - data key
      factory - 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 interface DataHolder
      Overrides:
      toMutable in class DataSet
    • toImmutable

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

      @NotNull public @NotNull MutableDataSet toDataSet()
      Specified by:
      toDataSet in interface DataHolder
      Overrides:
      toDataSet in class DataSet
    • clear

      @NotNull public @NotNull MutableDataSet clear()
      Description copied from interface: MutableDataHolder
      clear all options out of the data set
      Specified by:
      clear in interface MutableDataHolder
      Returns:
      mutable data holder for chained calls