Class AbstractSource<T>

  • Type Parameters:
    T - the configuration data type returned by this Source
    All Implemented Interfaces:
    Source<T>
    Direct Known Subclasses:
    DummySource, DynamicSource, FileSource, StringSource, URLSource

    public abstract class AbstractSource<T>
    extends Object
    implements Source<T>
    An abstract configuration source, with common infrastructure.
    Since:
    0.1.0
    Author:
    oswaldo.bapvic.jr (Oswaldo Junior)
    • Method Detail

      • load

        public T load​(Mapper<T> mapper,
                      boolean optional)
        Description copied from interface: Source
        Applies a specific configuration loading strategy and returns a mapped bean containing the retrieved data. If the optional parameter is true and the operation fails, this method returns null.
        Specified by:
        load in interface Source<T>
        Parameters:
        mapper - the Mapper to be applied on the source input stream
        optional - a flag indicating whether or not an exception should be thrown in an event of failure to load the configuration source
        Returns:
        the loaded configuration data, or null in an event of failure if the optional flag set as true
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • equals

        public boolean equals​(Object other)
        Indicates whether some other object is "equal to" this one.

        Two Source objects can be considered equal if both share the same implementation and parameter/path.

        Overrides:
        equals in class Object
        Parameters:
        other - the other object with which to compare
        Returns:
        true if this object is the same as the one specified in the argument; false otherwise.