Class CompositePropertyLoader

  • All Implemented Interfaces:
    PropertyLoader
    Direct Known Subclasses:
    PropertyLoaderKF

    public class CompositePropertyLoader
    extends Object
    implements PropertyLoader
    A composite property loader contains a list a property loaders. It searches the requested properties in its children sequentially respecting the order they are added.
    • Constructor Detail

      • CompositePropertyLoader

        public CompositePropertyLoader()
        Creates a new empty composite service loader.
    • Method Detail

      • addPropertyLoader

        public void addPropertyLoader​(PropertyLoader propertyLoader)
        Adds a property loader at the end of the list a property loaders used by this composite property loader.
        Parameters:
        propertyLoader - the property loader to add.
        Throws:
        NullPointerException - if the given property loader is null.
      • getProperty

        @Nullable
        public String getProperty​(String key)
        Description copied from interface: PropertyLoader
        Gets the value mapped with the specified key.
        Specified by:
        getProperty in interface PropertyLoader
        Parameters:
        key - the key.
        Returns:
        the value of the property, or null if the property is not found.
      • getProperty

        public String getProperty​(String key,
                                  String defaultValue)
        Description copied from interface: PropertyLoader
        Gets the value mapped with the specified key or a default value.
        Specified by:
        getProperty in interface PropertyLoader
        Parameters:
        key - the key.
        defaultValue - the default value.
        Returns:
        the value of the property, or the default value if the property is not found.