Interface ConfigurationService

All Known Implementing Classes:
ConfigurationServiceImpl

public interface ConfigurationService
Service holding runtime configuration properties.
Since:
7.4
  • Field Details

  • Method Details

    • getString

      Optional<String> getString(String key)
      Returns the given property value if any.
      Parameters:
      key - the property key
      Since:
      11.1
    • getString

      String getString(String key, String defaultValue)
      Returns the given property value if any, otherwise returns the given default value.
      Parameters:
      key - the property key
      defaultValue - the default value for this key
      Since:
      11.1
    • getInteger

      Optional<Integer> getInteger(String key)
      Returns the given property value if any.
      Parameters:
      key - the property key
      Since:
      11.1
    • getInteger

      int getInteger(String key, int defaultValue)
      Returns the given property value if any, otherwise returns the given default value.
      Parameters:
      key - the property key
      defaultValue - the default value for this key
      Since:
      11.1
    • getLong

      Optional<Long> getLong(String key)
      Returns the given property value if any.
      Parameters:
      key - the property key
      Since:
      11.1
    • getLong

      long getLong(String key, long defaultValue)
      Returns the given property value if any, otherwise returns the given default value.
      Parameters:
      key - the property key
      defaultValue - the default value for this key
      Since:
      11.1
    • getBoolean

      Optional<Boolean> getBoolean(String key)
      Returns the given property value if any.
      Parameters:
      key - the property key
      Since:
      11.1
    • isBooleanTrue

      boolean isBooleanTrue(String key)
      Returns true if given property exists and is true when compared to a boolean value.
       prop=true  | isBooleanTrue("prop") = true
       prop=trUe  | isBooleanTrue("prop") = true
       prop=false | isBooleanTrue("prop") = false
       prop=any   | isBooleanTrue("prop") = false
       prop=      | isBooleanTrue("prop") = false
       
      Since:
      11.1
    • isBooleanFalse

      boolean isBooleanFalse(String key)
      Returns true if given property exists and is false when compared to a boolean value.
       prop=false | isBooleanFalse("prop") = true
       prop=fAlse | isBooleanFalse("prop") = true
       prop=true  | isBooleanFalse("prop") = false
       prop=any   | isBooleanFalse("prop") = false
       prop=      | isBooleanFalse("prop") = false
       
      Since:
      11.1
    • getDuration

      Optional<Duration> getDuration(String key)
      Returns the given property value if any.
      Parameters:
      key - the property key
      Since:
      11.1
    • getDuration

      Duration getDuration(String key, Duration defaultValue)
      Returns the given property value if any, otherwise returns the given default value.
      Parameters:
      key - the property key
      defaultValue - the default value for this key
      Since:
      11.1
    • getProperty

      @Deprecated String getProperty(String key)
      Deprecated.
      since 11.1, use getString(String) instead
      Returns the given property value if any, otherwise null.
      Parameters:
      key - the property key
    • getProperty

      @Deprecated String getProperty(String key, String defaultValue)
      Deprecated.
      since 11.1, use getString(String, String) instead
      Returns the given property value if any, otherwise returns the given default value.
      Parameters:
      key - the property key
      defaultValue - the default value for this key
    • getProperties

      Map<String,Serializable> getProperties(String namespace)
      Returns the properties with key starting with the given namespace.
      Parameters:
      namespace - the namespace
      Returns:
      a map of properties with trimmed keys (namespace removed)
      Since:
      10.3
    • getProperties

      Map<String,Serializable> getProperties()
      Returns all the properties.
      Returns:
      a map of properties
      Since:
      2023.6
    • isBooleanPropertyTrue

      @Deprecated boolean isBooleanPropertyTrue(String key)
      Deprecated.
      since 11.1, use isBooleanTrue(String) instead
      Returns true if given property is true when compared to a boolean value.
    • isBooleanPropertyFalse

      @Deprecated boolean isBooleanPropertyFalse(String key)
      Deprecated.
      since 11.1, use isBooleanFalse(String) instead
      Returns true if given property is false when compared to a boolean value.

      Returns also true if property is not blank and is not equals to true.

    • getPropertiesAsJson

      String getPropertiesAsJson(String namespace) throws IOException
      Returns the json string representing the properties with key starting with the given namespace.
      Parameters:
      namespace - the namespace of the properties
      Throws:
      IOException
      Since:
      10.3