Interface PropertiesProvider


public interface PropertiesProvider
The interface exposing configuration properties.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    bindPropertyClass(String section, Class<T> clazz)
    Binds the configuration POJO to the specified section
    default String
    Returns the value of the property value with given key as String.
    default <T> T
    getProperty(String key, Class<T> asClazz)
    Returns the value of the property with given key as given type asClazz.
    <T> T
    getProperty(String key, Class<T> asClazz, T defaultValue)
    Returns the value of the property with given key as given type asClazz.
    getProperty(String key, String defaultValue)
    Returns the value of the property with given key as String.
    default boolean
    Checks if the property with given key is defined.
  • Method Details

    • bindPropertyClass

      <T> T bindPropertyClass(String section, Class<T> clazz)
      Binds the configuration POJO to the specified section
      Type Parameters:
      T - the type of the POJO
      Parameters:
      section - the properties section
      clazz - the class of the POJO
      Returns:
      The properties instance
    • hasProperty

      default boolean hasProperty(String key)
      Checks if the property with given key is defined.
      Parameters:
      key - The key of the property
      Returns:
      true if the property with key key is defined
    • getProperty

      default String getProperty(String key)
      Returns the value of the property value with given key as String.
      Parameters:
      key - The key of the property
      Returns:
      The String value or null if not defined
    • getProperty

      String getProperty(String key, String defaultValue)
      Returns the value of the property with given key as String. Returns the specified default value if key is not existing.
      Parameters:
      key - The key of the property
      defaultValue - The default value if the key is not present
      Returns:
      The String value or defaultValue if not defined
    • getProperty

      default <T> T getProperty(String key, Class<T> asClazz)
      Returns the value of the property with given key as given type asClazz.
      Type Parameters:
      T - the type of the property value
      Parameters:
      key - The key of the property
      asClazz - The type of the property value
      Returns:
      The value or null if not defined
    • getProperty

      <T> T getProperty(String key, Class<T> asClazz, T defaultValue)
      Returns the value of the property with given key as given type asClazz. Returns the specified default value if key is not existing.
      Type Parameters:
      T - the type of the property value
      Parameters:
      key - The key of the property
      asClazz - The type of the property value
      defaultValue - The default value if the key is not present
      Returns:
      The property value or defaultValue if not defined