Interface Source<T>

    • Method Detail

      • description

        default String description()
        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.

        description of the source
      • load

        Optional<T> load()
                  throws ConfigException
        Loads the underlying source data, converting it into an Optional around the parameterized type T.

        Implementations should return Optional.empty() if the underlying origin does not exist.

        The method can be invoked repeatedly, for example during retries.

        Optional<T> referring to an instance of T as read from the underlying origin of the data (if it exists) or Optional.empty() otherwise
        ConfigException - in case of errors loading from the underlying origin
      • close

        default void close()
                    throws Exception
        Closes the @{code Source}, releasing any resources it holds.
        Specified by:
        close in interface AutoCloseable
        Exception - in case of errors encountered while closing the source