- All Known Implementing Classes:
AttributeMap,CopyOnWriteValueMap,ValueMap
A
Map interface that holds values, parses Strings, and exposes a
variety of convenience methods.- Since:
- 1.2.6
- Author:
- Johan Compagner, Doug Donohoe
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetAsBoolean(String key) Retrieves aBooleanvalue by key.booleangetAsBoolean(String key, boolean defaultValue) Retrieves abooleanvalue by key.getAsDouble(String key) Retrieves aDoublevalue by key.doublegetAsDouble(String key, double defaultValue) Retrieves adoublevalue by key.getAsDuration(String key) Retrieves aDurationvalue by key.getAsDuration(String key, Duration defaultValue) Retrieves aDurationvalue by key.<T extends Enum<T>>
TRetrieves anEnumvalue by key.<T extends Enum<T>>
TRetrieves anEnumvalue by key.<T extends Enum<T>>
TRetrieves anEnumvalue by key.getAsInstant(String key) Retrieves aTimevalue by key.getAsInteger(String key) Retrieves anIntegervalue by key.intgetAsInteger(String key, int defaultValue) Retrieves anintegervalue by key.Retrieves aLongvalue by key.longRetrieves alongvalue by key.Retrieves aTimevalue by key.booleangetBoolean(String key) Retrieves abooleanvalue by key.getCharSequence(String key) Retrieves aCharSequenceby key.doubleRetrieves adoublevalue by key.doubleRetrieves adoublevalue by key, using a default value if not found.getDuration(String key) Retrieves aDurationby key.getInstant(String key) Retrieves aInstantobject by key.intRetrieves anintvalue by key.intRetrieves anintvalue by key, using a default value if not found.Provided that the hash key is aStringand you need to access the value ignoring the key's case (upper- or lowercase letters), then you may use this method to get the correct writing.longRetrieves alongvalue by key.longRetrieves alongvalue by key, using a default value if not found.Retrieves aStringby key.Retrieves aStringby key, using a default value if not found.String[]getStringArray(String key) Retrieves aStringarray by key.getStringValue(String key) Retrieves aStringValueobject by key.booleanReturns whether or not thisIValueMapis immutable.Makes thisIValueMapimmutable by changing the underlying map representation to aCollections.unmodifiableMap.Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Method Details
-
getBoolean
Retrieves abooleanvalue by key.- Parameters:
key- the key- Returns:
- the value
- Throws:
StringValueConversionException
-
getDouble
Retrieves adoublevalue by key.- Parameters:
key- the key- Returns:
- the value
- Throws:
StringValueConversionException
-
getDouble
Retrieves adoublevalue by key, using a default value if not found.- Parameters:
key- the keydefaultValue- value to use if no value is in thisIValueMap- Returns:
- the value
- Throws:
StringValueConversionException
-
getDuration
Retrieves aDurationby key.- Parameters:
key- the key- Returns:
- the
Durationvalue - Throws:
StringValueConversionException
-
getInt
Retrieves anintvalue by key.- Parameters:
key- the key- Returns:
- the value
- Throws:
StringValueConversionException
-
getInt
Retrieves anintvalue by key, using a default value if not found.- Parameters:
key- the keydefaultValue- value to use if no value is in thisIValueMap- Returns:
- the value
- Throws:
StringValueConversionException
-
getLong
Retrieves alongvalue by key.- Parameters:
key- the key- Returns:
- the value
- Throws:
StringValueConversionException
-
getLong
Retrieves alongvalue by key, using a default value if not found.- Parameters:
key- the keydefaultValue- value to use if no value in thisIValueMap- Returns:
- the value
- Throws:
StringValueConversionException
-
getString
Retrieves aStringby key, using a default value if not found.- Parameters:
key- the keydefaultValue- default value to return if value isnull- Returns:
- the
String
-
getString
Retrieves aStringby key.- Parameters:
key- the key- Returns:
- the
String
-
getCharSequence
Retrieves aCharSequenceby key.- Parameters:
key- the key- Returns:
- the
CharSequence
-
getStringArray
Retrieves aStringarray by key. If the value was aString[]it will be returned directly. If it was aStringit will be converted to aStringarray of length one. If it was an array of another type, aStringarray will be made and each element will be converted to aString.- Parameters:
key- the key- Returns:
- the
Stringarray of that key
-
getStringValue
Retrieves aStringValueobject by key.- Parameters:
key- the key- Returns:
- the
StringValueobject
-
getInstant
Retrieves aInstantobject by key.- Parameters:
key- the key- Returns:
- the
Instantobject - Throws:
StringValueConversionException
-
isImmutable
boolean isImmutable()Returns whether or not thisIValueMapis immutable.- Returns:
- whether or not this
IValueMapis immutable
-
makeImmutable
Makes thisIValueMapimmutable by changing the underlying map representation to aCollections.unmodifiableMap. After calling this method, any attempt to modify thisIValueMapwill result in aRuntimeExceptionbeing thrown by theCollectionsframework.- Returns:
- this
IValueMap
-
getKey
Provided that the hash key is aStringand you need to access the value ignoring the key's case (upper- or lowercase letters), then you may use this method to get the correct writing.- Parameters:
key- the key- Returns:
- the key with the correct writing
-
getAsBoolean
Retrieves aBooleanvalue by key.- Parameters:
key- the key- Returns:
- the value or null if value is not a valid boolean or no value is in this
IValueMap
-
getAsBoolean
Retrieves abooleanvalue by key.- Parameters:
key- the keydefaultValue- the default to return- Returns:
- the value or defaultValue if value is not a valid boolean or no value is in this
IValueMap
-
getAsInteger
Retrieves anIntegervalue by key.- Parameters:
key- the key- Returns:
- the value or null if value is not a valid integer or no value is in this
IValueMap
-
getAsInteger
Retrieves anintegervalue by key.- Parameters:
key- the keydefaultValue- the default to return- Returns:
- the value or defaultValue if value is not a valid integer or no value is in this
IValueMap
-
getAsLong
Retrieves aLongvalue by key.- Parameters:
key- the key- Returns:
- the value or null if value is not a valid long or no value is in this
IValueMap
-
getAsLong
Retrieves alongvalue by key.- Parameters:
key- the keydefaultValue- the default to return- Returns:
- the value or defaultValue if value is not a valid long or no value is in this
IValueMap
-
getAsDouble
Retrieves aDoublevalue by key.- Parameters:
key- the key- Returns:
- the value or null if value is not a valid double or no value is in this
IValueMap
-
getAsDouble
Retrieves adoublevalue by key.- Parameters:
key- the keydefaultValue- the default to return- Returns:
- the value or defaultValue if value is not a valid double or no value is in this
IValueMap
-
getAsDuration
Retrieves aDurationvalue by key.- Parameters:
key- the key- Returns:
- the value or null if value is not a valid Duration or no value is in this
IValueMap
-
getAsDuration
Retrieves aDurationvalue by key.- Parameters:
key- the keydefaultValue- the default to return- Returns:
- the value or defaultValue if value is not a valid Duration or no value is in this
IValueMap
-
getAsInstant
Retrieves aTimevalue by key.- Parameters:
key- the key- Returns:
- the value or null if value is not a valid Time or no value is in this
IValueMap
-
getAsTime
Retrieves aTimevalue by key.- Parameters:
key- the keydefaultValue- the default to return- Returns:
- the value or defaultValue if value is not a valid Time or no value is in this
IValueMap
-
getAsEnum
Retrieves anEnumvalue by key.- Type Parameters:
T- type of enum- Parameters:
key- the keyeClass- the enumeration class- Returns:
- the value or null if value is not a valid value of the Enumeration or no value is in
this
IValueMap
-
getAsEnum
Retrieves anEnumvalue by key.- Type Parameters:
T- type of enum- Parameters:
key- the keydefaultValue- the default value from the Enumeration (cannot be null)- Returns:
- the value or defaultValue if value is not a valid value of the Enumeration or no
value is in this
IValueMap
-
getAsEnum
Retrieves anEnumvalue by key.- Type Parameters:
T- type of enum- Parameters:
key- the keyeClass- the enumeration classdefaultValue- the default value from the Enumeration (may be null)- Returns:
- the value or defaultValue if value is not a valid value of the Enumeration or no
value is in this
IValueMap
-