Class AbstractPropertyConfiguration

    • Constructor Detail

      • AbstractPropertyConfiguration

        public AbstractPropertyConfiguration​(Map<String,​String> properties)
        Creates a new instance with given properties.
        Parameters:
        properties - configuration properties
    • Method Detail

      • getStringProperty

        public String getStringProperty​(String name,
                                        String defaultValue)
        Description copied from interface: AbstractConfiguration
        Gets a configured property as a string.
        Specified by:
        getStringProperty in interface AbstractConfiguration
        Parameters:
        name - The simple of the property, in some contexts, lookup might be performed using variations of the provided name.
        defaultValue - the default value that should be used if no value has been defined
        Returns:
        the property value, or the passed default value if no property value is found
      • getBooleanProperty

        public boolean getBooleanProperty​(String name,
                                          boolean defaultValue)
        Description copied from interface: AbstractConfiguration
        Gets a configured property as a boolean.
        Specified by:
        getBooleanProperty in interface AbstractConfiguration
        Parameters:
        name - The simple of the property, in some contexts, lookup might be performed using variations of the provided name.
        defaultValue - the default value that should be used if no value has been defined
        Returns:
        the property value, or the passed default value if no property value is found
      • getApplicationProperty

        public String getApplicationProperty​(String parameterName)
        Gets an application property value.
        Parameters:
        parameterName - the Name or the parameter.
        Returns:
        String value or null if not found
      • getProperties

        protected Map<String,​String> getProperties()
        Gets unmodifiable underlying properties.
        Returns:
        the properties map
      • getApplicationOrSystemProperty

        public <T> T getApplicationOrSystemProperty​(String propertyName,
                                                    T defaultValue,
                                                    Function<String,​T> converter)
        Gets a configured property. The properties are typically read from e.g. web.xml or from system properties of the JVM.
        Type Parameters:
        T - type of a property
        Parameters:
        propertyName - The simple of the property, in some contexts, lookup might be performed using variations of the provided name.
        defaultValue - the default value that should be used if no value has been defined
        converter - the way string should be converted into the required property
        Returns:
        the property value, or the passed default value if no property value is found
      • getSystemProperty

        protected String getSystemProperty​(String parameterName)
        Gets an system property value.
        Parameters:
        parameterName - the Name or the parameter.
        Returns:
        String value or null if not found
      • getApplicationProperty

        protected String getApplicationProperty​(Function<String,​String> valueProvider,
                                                String propertyName)
        Gets application property value using the valueProvider.
        Parameters:
        valueProvider - a value provider for the property
        propertyName - the name or the parameter.
        Returns:
        String value or null if not found