Class MutableDataSet

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