- java.lang.Object
-
- util.misc.PropertyDefaults
-
public class PropertyDefaults extends java.lang.Object
A class that stores a HashMap with default values for Properties- Since:
- 3.3.4
- Author:
- René Mach
-
-
Constructor Summary
Constructors Constructor Description PropertyDefaults(java.util.HashMap<java.lang.String,java.lang.String> defaultValueMap)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getDefaultValueForKey(java.lang.String key)
Gets the default value of this property defaults for the given key.java.util.Properties
getProperties()
Gets the properties to use for this property defaults.java.lang.String
getValueFromProperties(java.lang.String key)
Gets the value for the given key from the previously set properties or the default value for the key of this property defaults.java.lang.String
getValueFromProperties(java.lang.String key, java.util.Properties properties)
Gets the value for the given key from the given properties, the properties previously set if given properties isnull
or the default value for the key of this property defaults.void
setProperties(java.util.Properties properties)
Sets the properties to use for this property defaults.
-
-
-
Method Detail
-
setProperties
public void setProperties(java.util.Properties properties)
Sets the properties to use for this property defaults.- Parameters:
properties
- The properties to use.- Since:
- 3.4.1
-
getValueFromProperties
public java.lang.String getValueFromProperties(java.lang.String key)
Gets the value for the given key from the previously set properties or the default value for the key of this property defaults.- Parameters:
key
- The key of the property value to get.- Returns:
- A value or
null
if no value exists for the given key. - Since:
- 3.4.1
-
getValueFromProperties
public java.lang.String getValueFromProperties(java.lang.String key, java.util.Properties properties)
Gets the value for the given key from the given properties, the properties previously set if given properties isnull
or the default value for the key of this property defaults.- Parameters:
key
- The key of the property value to get.properties
- The properties to get the value from ornull
to use previously set properties or to get default value if no property is set.- Returns:
- A value or
null
if no value exists for the given key.
-
getDefaultValueForKey
public java.lang.String getDefaultValueForKey(java.lang.String key)
Gets the default value of this property defaults for the given key.- Parameters:
key
- The key of the property value default to get.- Returns:
- The default value or
null
if no default value exists for the given key.
-
getProperties
public java.util.Properties getProperties()
Gets the properties to use for this property defaults.- Returns:
- The previously set properties or
null
if no properties were set. - Since:
- 3.4.1
-
-