Class Settings
- All Implemented Interfaces:
Serializable, Cloneable, Map<String,Object>
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Constructor Summary
ConstructorsConstructorDescriptionSettings()Constructs an emptySettingsinstance with the default initial capacity and load factor.Settings(int initialCapacity) Constructs an emptySettingsinstance with the specified initial capacity and a default load factor.Settings(int initialCapacity, float loadFactor) Constructs an emptySettingsinstance with the specified initial capacity and load factor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPropertyChangeListener(String key, PropertyChangeListener listener) Adds alistenerto the list of change listeners of this map.voidclear()Removes all of the mappings from this map.Returns the value to which the specified object key is mapped.Returns the value to which the specified string key is mapped.Returns the object value of a mapping ordefvalif not defined.getBigDecimal(String key) Returns the decimal value of a mapping orZEROif not defined.getBigDecimal(String key, BigDecimal defval) Returns the decimal value of a mapping ordefvalif not defined.booleangetBoolean(String key) Returns the boolean value of a mapping orfalseif not defined.booleangetBoolean(String key, boolean defval) Returns the boolean value of the key ordefvalif not defined.Returns the date value of a mapping ornullif not defined.Returns the date value of a mapping ordefvalif not defined.doubleReturns the double value of a mapping or0if not defined.doubleReturns the double value of a mapping ordefvalif not defined.intReturns the integer value of a mapping or0if not defined.intReturns the integer value of a mapping ordefvalif not defined.longReturns the long value of a mapping or0if not defined.longReturns the long value of a mapping ordefvalif not defined.Returns the string value of a mapping ornullif not defined.Returns the string value of a mapping ordefvalif not defined.Associates the specified value with the specified key in this map.voidCopies all of the mappings from the specifiedmapto this map.voidputAll(Properties properties) Copies all of the mappings ofpropertiesto this map.voidputDefaults(Settings settings) Adds the mappings ofsettingsnot contained in this map.voidputDefaults(Properties properties) Adds the mappings ofpropertiesnot contained in this map.voidCopies all of the mappings of supplied map to this map.Removes the mapping for the specified key from this map if present.voidremovePropertyChangeListener(String key, PropertyChangeListener listener) Removes alistenerfrom the list of change listeners of this map.Methods inherited from class HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, getOrDefault, isEmpty, keySet, merge, newHashMap, putIfAbsent, remove, replace, replace, replaceAll, size, valuesMethods inherited from class AbstractMap
equals, hashCode, toString
-
Constructor Details
-
Settings
public Settings()Constructs an emptySettingsinstance with the default initial capacity and load factor. -
Settings
public Settings(int initialCapacity, float loadFactor) Constructs an emptySettingsinstance with the specified initial capacity and load factor.- Parameters:
initialCapacity- the initial capacity.loadFactor- the load factor.- Throws:
IllegalArgumentException- if the initial capacity is negative or the load factor is nonpositive.
-
Settings
public Settings(int initialCapacity) Constructs an emptySettingsinstance with the specified initial capacity and a default load factor.- Parameters:
initialCapacity- the initial capacity.- Throws:
IllegalArgumentException- if the initial capacity is negative.
-
-
Method Details
-
put
Associates the specified value with the specified key in this map. If the map previously contained a mapping for the key, the old value is replaced. Registered listeners are notified of the changed mappings.- Specified by:
putin interfaceMap<String,Object> - Overrides:
putin classHashMap<String,Object> - Parameters:
key- the key with which the specified value is to be associated.value- value to be associated with the specified key.- Returns:
- the previous value associated with
keyornull. - Throws:
NullPointerException- if an argument isnull.
-
putAll
Copies all of the mappings from the specifiedmapto this map. These mappings will replace any mappings that this map had for any of the keys currently in the specified map. Registered listeners are notified of the changed mappings. -
putAll
Copies all of the mappings ofpropertiesto this map. These mappings replace any mappings that this map had for any of the keys currently in the specifiedProperties. Registered listeners are notified of the changed mappings.- Parameters:
properties- the properties to copy to this map.- Throws:
NullPointerException- ifpropertiesisnull.
-
putMap
Copies all of the mappings of supplied map to this map. These mappings replace any mappings that this map had for any of the keys currently in the specifiedmap. Registered listeners are notified of the changed mappings.- Parameters:
map- the map to copy to this map.- Throws:
NullPointerException- ifmapisnull.
-
putDefaults
Adds the mappings ofsettingsnot contained in this map. The mappings that currently exist in this map are not changed. Registered listeners are notified of the changed mappings.- Parameters:
settings- the settings to add to this map.- Throws:
NullPointerException- ifsettingsisnull.
-
putDefaults
Adds the mappings ofpropertiesnot contained in this map. The mappings that currently exist in this map are not changed. Registered listeners are notified of the changed mappings.- Parameters:
properties- the properties to add to this map.- Throws:
NullPointerException- ifpropertiesisnull.
-
remove
Removes the mapping for the specified key from this map if present. Registered listeners are notified of the removed mappings. -
clear
-
get
Returns the value to which the specified object key is mapped. -
get
Returns the value to which the specified string key is mapped.- Parameters:
key- the string key of the mapping.- Returns:
- the object value or
nullif not defined. - Throws:
NullPointerException- ifkeyisnull.
-
get
Returns the object value of a mapping ordefvalif not defined.- Parameters:
key- the key of the mapping.defval- the default value.- Returns:
- the object value or
defvalif not defined. - Throws:
NullPointerException- ifkeyisnull.
-
getString
Returns the string value of a mapping ornullif not defined.- Parameters:
key- the key of the mapping.- Returns:
- the string value or
nullif not defined. - Throws:
NullPointerException- ifkeyisnull.
-
getString
Returns the string value of a mapping ordefvalif not defined.- Parameters:
key- the key of the mapping.defval- the default value.- Returns:
- the string value or
defvalif not defined. - Throws:
NullPointerException- ifkeyisnull.
-
getDouble
Returns the double value of a mapping or0if not defined.- Parameters:
key- the key of the mapping.- Returns:
- the double value or
0if not defined. - Throws:
NullPointerException- ifkeyisnull.NumberFormatException- if the value is not aDouble.
-
getDouble
Returns the double value of a mapping ordefvalif not defined.- Parameters:
key- the key of the mapping.defval- the default value.- Returns:
- the double value or
defvalif not defined. - Throws:
NullPointerException- ifkeyisnull.NumberFormatException- if the value is not aDouble.
-
getInt
Returns the integer value of a mapping or0if not defined.- Parameters:
key- the key of the mapping.- Returns:
- the integer value or
0if not defined. - Throws:
NullPointerException- ifkeyisnull.NumberFormatException- if the value is not anInteger.
-
getInt
Returns the integer value of a mapping ordefvalif not defined.- Parameters:
key- the key of the mapping.defval- the default value.- Returns:
- the integer value or
defvalif not defined. - Throws:
NullPointerException- ifkeyisnull.NumberFormatException- if the value is not anInteger.
-
getLong
Returns the long value of a mapping or0if not defined.- Parameters:
key- the key of the mapping.- Returns:
- the long value or
0if not defined. - Throws:
NullPointerException- ifkeyisnull.NumberFormatException- if the value is not aLong.
-
getLong
Returns the long value of a mapping ordefvalif not defined.- Parameters:
key- the key of the mapping.defval- the default value.- Returns:
- the long value or
defvalif not defined. - Throws:
NullPointerException- ifkeyisnull.NumberFormatException- if the value is not aLong.
-
getBigDecimal
Returns the decimal value of a mapping orZEROif not defined.- Parameters:
key- the key of the mapping.- Returns:
- the decimal value or
ZEROif not defined. - Throws:
NullPointerException- ifkeyisnull.NumberFormatException- if the value is not aBigDecimal.
-
getBigDecimal
Returns the decimal value of a mapping ordefvalif not defined.- Parameters:
key- the key of the mapping.defval- the default value.- Returns:
- the decimal value or
defvalif not defined. - Throws:
NullPointerException- ifkeyisnull.NumberFormatException- if the value is not aBigDecimal.
-
getBoolean
Returns the boolean value of a mapping orfalseif not defined.- Parameters:
key- the key of the mapping.- Returns:
- the boolean value or
falseif not defined. - Throws:
NullPointerException- ifkeyisnull.ClassCastException- if the value is not aBoolean.
-
getBoolean
Returns the boolean value of the key ordefvalif not defined.- Parameters:
key- the key of the mapping.defval- the default value.- Returns:
- the boolean value or
defvalif not defined. - Throws:
NullPointerException- ifkeyisnull.
-
getDate
Returns the date value of a mapping ornullif not defined.- Parameters:
key- the key of the mapping.- Returns:
- the date value or
nullif not defined. - Throws:
NullPointerException- ifkeyisnull.IllegalArgumentException- if the value is not aDate.
-
getDate
Returns the date value of a mapping ordefvalif not defined.- Parameters:
key- the key of the mapping.defval- the default value.- Returns:
- the date value or
defvalif not defined. - Throws:
NullPointerException- ifkeyisnull.IllegalArgumentException- if the value is not aDate.
-
addPropertyChangeListener
Adds alistenerto the list of change listeners of this map.- Parameters:
key- the key of the mapping.listener- the property change listener.- Throws:
NullPointerException- if an argument isnull.
-
removePropertyChangeListener
Removes alistenerfrom the list of change listeners of this map.- Parameters:
key- the key of the mapping.listener- the property change listener.- Throws:
NullPointerException- if an argument isnull.
-