Interface Properties

    • Method Detail

      • hashCode

        static int hashCode​(Properties properties)
      • has

        default boolean has​(String key)
        Check if a key exists
        Parameters:
        key - the key
        Returns:
        true if a property with the given key exists
      • has

        default boolean has​(String key,
                            Class<?> clazz)
        Check if key existing and its value is of a specific class
        Returns:
        true if a property of the given class with the given key exists
      • get

        default Optional<Object> get​(String key)
        Get the proprety value
        Parameters:
        key - the key
        Returns:
        the property value for the specified key, if it exists
      • getProperty

        default <T> Optional<T> getProperty​(String key,
                                            Class<T> clazz)
        Get the property value of specified class
        Parameters:
        key - the key
        clazz - the requried value classs
        Returns:
        the property value as the specified class for the specified key, if it exists
      • getObjectOrDefault

        default Object getObjectOrDefault​(String key,
                                          Object defaultValue)
        Get the value or use a default if missing
        Parameters:
        key - the key
        defaultValue - the value to return if key is not present
        Returns:
        the property value as an Object for the specified key, or a default value if the key doesn't exist
      • getOrDefault

        default <T> T getOrDefault​(String key,
                                   T defaultValue)
        Get a specific class at the key, or use the default
        Parameters:
        key - the key
        defaultValue - the value to return if key is missing or of different type (non-null)
        Returns:
        the property value for the specified key, or a default value if the key doesn't exist
      • keys

        default Stream<String> keys​()
        Get all keys
        Returns:
        all currently set property keys
      • listKeys

        default <T> Stream<String> listKeys​(Class<T> clazz)
        Get all keys which have the value an instance of class
        Parameters:
        clazz - the class to filter on
        Returns:
        all the property keys that have a value of the specified class
      • getAll

        Map<String,Object> getAll​()
        Get the properties as a map
        Returns:
        a map of all properties
      • getAll

        default <T> Map<String,T> getAll​(Class<T> clazz)
        Get all properties which have a value instance of class
        Parameters:
        clazz - the class to filter on
        Returns:
        a map of all properties that have a value of the specified class