Class AbstractSource<T,​S>

    • Method Detail

      • uid

        protected String uid()
        Returns universal id of source to be used to construct description().
        Returns:
        universal id of source
      • isMandatory

        protected boolean isMandatory()
      • fireChangeEvent

        protected void fireChangeEvent()
        Fires a change event when source has changed.
      • processLoadedData

        protected AbstractSource.Data<T,​S> processLoadedData​(AbstractSource.Data<T,​S> data)
        Performs any postprocessing of config data after loading. By default, the method simply returns the provided input Data.
        Parameters:
        data - an input data
        Returns:
        a post-processed data
      • dataStamp

        protected abstract Optional<S> dataStamp()
        Returns current stamp of data in config source.
        Returns:
        current datastamp of data in config source
      • load

        public final Optional<T> load()
        Loads data from source when data expires.
        Specified by:
        load in interface Source<T>
        Returns:
        the last loaded data
      • loadData

        protected abstract AbstractSource.Data<T,​S> loadData()
                                                            throws ConfigException
        Loads new data from config source.
        Returns:
        newly loaded data with appropriate data timestamp used for future method calls
        Throws:
        ConfigException - in case it is not possible to load configuration data
      • description

        public final String description()
        Description copied from interface: Source
        Short, human-readable summary referring to the underlying source.

        For example, a file path or a URL or any other information that helps the user recognize the underlying origin of the data this Source provides.

        Default is the implementation class simple name with any "Source" suffix removed.

        Specified by:
        description in interface Source<T>
        Returns:
        description of the source