Class Document

    • Field Detail

      • NULL

        public static final Document NULL
    • Method Detail

      • set

        @NotNull
        public <T> MutableDataHolder set​(@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> MutableDataHolder set​(@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
      • setAll

        @NotNull
        public MutableDataSet setAll​(@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 MutableDataSet remove​(@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 java.lang.Object getOrCompute​(@NotNull
                                             DataKeyBase<?> key,
                                             @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
        Parameters:
        key - data key
        factory - factory taking this data holder and computing/providing default value
        Returns:
        object value for the key
      • aggregate

        @NotNull
        public DataHolder aggregate()
      • getAll

        @NotNull
        public java.util.Map<? extends DataKeyBase<?>,​java.lang.Object> getAll()
        Specified by:
        getAll in interface DataHolder
      • getLineNumber

        public int getLineNumber​(int offset)
        Get line number at offset

        Next line starts after the EOL sequence. offsets between \r and \n are considered part of the same line as offset before \r.

        Parameters:
        offset - offset in document text
        Returns:
        line number at offset