-
- All Known Subinterfaces:
ImmutableProperties,MutableProperties
public interface PropertiesBase properties interface from which all other properties objects/interfaces extend.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static booleanequals(Properties a, Properties b)default Optional<Object>get(String key)Get the proprety valueMap<String,Object>getAll()Get the properties as a mapdefault <T> Map<String,T>getAll(Class<T> clazz)Get all properties which have a value instance of classdefault ObjectgetObjectOrDefault(String key, Object defaultValue)Get the value or use a default if missingdefault <T> TgetOrDefault(String key, T defaultValue)Get a specific class at the key, or use the defaultdefault <T> Optional<T>getProperty(String key, Class<T> clazz)Get the property value of specified classdefault booleanhas(String key)Check if a key existsdefault booleanhas(String key, Class<?> clazz)Check if key existing and its value is of a specific classstatic inthashCode(Properties properties)default Stream<String>keys()Get all keysdefault <T> Stream<String>listKeys(Class<T> clazz)Get all keys which have the value an instance of class
-
-
-
Method Detail
-
equals
static boolean equals(Properties a, Properties b)
-
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 keyclazz- 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 keydefaultValue- 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 keydefaultValue- 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
-
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
-
-