Class MultipleConfigurationSource

    • Constructor Summary

      Constructors 
      Constructor Description
      MultipleConfigurationSource​(java.util.List<ConfigurationSource> configurationSourcesIn)
      Build a combined configuration source from the combination of all the ones specified in the list.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Optional<java.lang.Boolean> getBoolean​(java.lang.String property)
      Retrieve the boolean value of a property.
      java.util.Optional<java.lang.Double> getDouble​(java.lang.String property)
      Retrieve the double value of a property.
      private <T> java.util.Optional<T> getFirstValue​(java.lang.String property, java.util.function.BiFunction<ConfigurationSource,​java.lang.String,​java.util.Optional<T>> propertyRetriever)  
      java.util.Optional<java.lang.Float> getFloat​(java.lang.String property)
      Retrieve the float value of a property.
      java.util.Optional<java.lang.Integer> getInteger​(java.lang.String property)
      Retrieve the integer value of a property.
      <T> java.util.Optional<java.util.List<T>> getList​(java.lang.String property, java.lang.Class<T> itemClass)
      Retrieve the list value of a property.
      java.util.Optional<java.lang.Long> getLong​(java.lang.String property)
      Retrieve the long value of a property.
      java.util.Set<java.lang.String> getPropertyNames()
      Retrieves the names of all the available properties.
      java.util.Optional<java.lang.String> getString​(java.lang.String property)
      Retrieve the string value of a property.
      java.util.Properties toProperties()
      Converts this configuration source to a Properties object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • configurationSources

        private final java.util.Deque<ConfigurationSource> configurationSources
    • Constructor Detail

      • MultipleConfigurationSource

        public MultipleConfigurationSource​(java.util.List<ConfigurationSource> configurationSourcesIn)
        Build a combined configuration source from the combination of all the ones specified in the list.
        Parameters:
        configurationSourcesIn - the list of sources. The order of the sources will be respected when retrieving the properties.
    • Method Detail

      • getBoolean

        public java.util.Optional<java.lang.Boolean> getBoolean​(java.lang.String property)
        Description copied from interface: ConfigurationSource
        Retrieve the boolean value of a property.
        Specified by:
        getBoolean in interface ConfigurationSource
        Parameters:
        property - the property name
        Returns:
        the boolean wrapped into an Optional
      • getString

        public java.util.Optional<java.lang.String> getString​(java.lang.String property)
        Description copied from interface: ConfigurationSource
        Retrieve the string value of a property.
        Specified by:
        getString in interface ConfigurationSource
        Parameters:
        property - the property name
        Returns:
        the string wrapped into an Optional
      • getInteger

        public java.util.Optional<java.lang.Integer> getInteger​(java.lang.String property)
        Description copied from interface: ConfigurationSource
        Retrieve the integer value of a property.
        Specified by:
        getInteger in interface ConfigurationSource
        Parameters:
        property - the property name
        Returns:
        the integer wrapped into an Optional
      • getLong

        public java.util.Optional<java.lang.Long> getLong​(java.lang.String property)
        Description copied from interface: ConfigurationSource
        Retrieve the long value of a property.
        Specified by:
        getLong in interface ConfigurationSource
        Parameters:
        property - the property name
        Returns:
        the long wrapped into an Optional
      • getFloat

        public java.util.Optional<java.lang.Float> getFloat​(java.lang.String property)
        Description copied from interface: ConfigurationSource
        Retrieve the float value of a property.
        Specified by:
        getFloat in interface ConfigurationSource
        Parameters:
        property - the property name
        Returns:
        the float wrapped into an Optional
      • getDouble

        public java.util.Optional<java.lang.Double> getDouble​(java.lang.String property)
        Description copied from interface: ConfigurationSource
        Retrieve the double value of a property.
        Specified by:
        getDouble in interface ConfigurationSource
        Parameters:
        property - the property name
        Returns:
        the double wrapped into an Optional
      • getList

        public <T> java.util.Optional<java.util.List<T>> getList​(java.lang.String property,
                                                                 java.lang.Class<T> itemClass)
        Description copied from interface: ConfigurationSource
        Retrieve the list value of a property.
        Specified by:
        getList in interface ConfigurationSource
        Type Parameters:
        T - the type of item of the list
        Parameters:
        property - the property name
        itemClass - the type of item of the list.
        Returns:
        the list wrapped into an Optional
      • getFirstValue

        private <T> java.util.Optional<T> getFirstValue​(java.lang.String property,
                                                        java.util.function.BiFunction<ConfigurationSource,​java.lang.String,​java.util.Optional<T>> propertyRetriever)
      • getPropertyNames

        public java.util.Set<java.lang.String> getPropertyNames()
        Description copied from interface: ConfigurationSource
        Retrieves the names of all the available properties.
        Specified by:
        getPropertyNames in interface ConfigurationSource
        Returns:
        the set of property names
      • toProperties

        public java.util.Properties toProperties()
        Description copied from interface: ConfigurationSource
        Converts this configuration source to a Properties object.
        Specified by:
        toProperties in interface ConfigurationSource
        Returns:
        all the properties value stored into Properties object