java.lang.Object
org.apache.wicket.util.value.CopyOnWriteValueMap
- All Implemented Interfaces:
Serializable,Map<String,,Object> IValueMap
An implementation of
IValueMap that makes a copy when a caller tries to change an
immutable Map. That is, the Map may or may not be immutable, but if it
is, a copy is made.- Since:
- 1.2.6
- Author:
- Johan Compagner, Doug Donohoe
- See Also:
-
Nested Class Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()booleangetAsBoolean(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.inthashCode()booleanisEmpty()booleanReturns whether or not thisIValueMapis immutable.keySet()Makes thisIValueMapimmutable by changing the underlying map representation to aCollections.unmodifiableMap.voidintsize()values()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
CopyOnWriteValueMap
Constructor.- Parameters:
wrapped- the wrappedIValueMap
-
-
Method Details
-
clear
-
containsKey
- Specified by:
containsKeyin interfaceMap<String,Object>
-
containsValue
- Specified by:
containsValuein interfaceMap<String,Object>
-
entrySet
-
equals
-
hashCode
-
get
-
getBoolean
Description copied from interface:IValueMapRetrieves abooleanvalue by key.- Specified by:
getBooleanin interfaceIValueMap- Parameters:
key- the key- Returns:
- the value
- Throws:
StringValueConversionException
-
getCharSequence
Description copied from interface:IValueMapRetrieves aCharSequenceby key.- Specified by:
getCharSequencein interfaceIValueMap- Parameters:
key- the key- Returns:
- the
CharSequence
-
getDouble
Description copied from interface:IValueMapRetrieves adoublevalue by key.- Specified by:
getDoublein interfaceIValueMap- Parameters:
key- the key- Returns:
- the value
- Throws:
StringValueConversionException
-
getDouble
Description copied from interface:IValueMapRetrieves adoublevalue by key, using a default value if not found. -
getDuration
Description copied from interface:IValueMapRetrieves aDurationby key.- Specified by:
getDurationin interfaceIValueMap- Parameters:
key- the key- Returns:
- the
Durationvalue - Throws:
StringValueConversionException
-
getInt
Description copied from interface:IValueMapRetrieves anintvalue by key, using a default value if not found. -
getInt
Description copied from interface:IValueMapRetrieves anintvalue by key.- Specified by:
getIntin interfaceIValueMap- Parameters:
key- the key- Returns:
- the value
- Throws:
StringValueConversionException
-
getKey
Description copied from interface:IValueMapProvided 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. -
getLong
Description copied from interface:IValueMapRetrieves alongvalue by key, using a default value if not found. -
getLong
Description copied from interface:IValueMapRetrieves alongvalue by key.- Specified by:
getLongin interfaceIValueMap- Parameters:
key- the key- Returns:
- the value
- Throws:
StringValueConversionException
-
getString
Description copied from interface:IValueMapRetrieves aStringby key, using a default value if not found. -
getString
Description copied from interface:IValueMapRetrieves aStringby key. -
getStringArray
Description copied from interface:IValueMapRetrieves 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.- Specified by:
getStringArrayin interfaceIValueMap- Parameters:
key- the key- Returns:
- the
Stringarray of that key
-
getStringValue
Description copied from interface:IValueMapRetrieves aStringValueobject by key.- Specified by:
getStringValuein interfaceIValueMap- Parameters:
key- the key- Returns:
- the
StringValueobject
-
getInstant
Description copied from interface:IValueMapRetrieves aInstantobject by key.- Specified by:
getInstantin interfaceIValueMap- Parameters:
key- the key- Returns:
- the
Instantobject - Throws:
StringValueConversionException
-
isEmpty
-
isImmutable
Description copied from interface:IValueMapReturns whether or not thisIValueMapis immutable.- Specified by:
isImmutablein interfaceIValueMap- Returns:
- whether or not this
IValueMapis immutable
-
keySet
-
makeImmutable
Description copied from interface:IValueMapMakes 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.- Specified by:
makeImmutablein interfaceIValueMap- Returns:
- this
IValueMap
-
put
-
putAll
-
remove
-
size
-
values
-
getAsBoolean
Description copied from interface:IValueMapRetrieves aBooleanvalue by key.- Specified by:
getAsBooleanin interfaceIValueMap- Parameters:
key- the key- Returns:
- the value or null if value is not a valid boolean or no value is in this
IValueMap
-
getAsBoolean
Description copied from interface:IValueMapRetrieves abooleanvalue by key.- Specified by:
getAsBooleanin interfaceIValueMap- 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
Description copied from interface:IValueMapRetrieves anIntegervalue by key.- Specified by:
getAsIntegerin interfaceIValueMap- Parameters:
key- the key- Returns:
- the value or null if value is not a valid integer or no value is in this
IValueMap
-
getAsInteger
Description copied from interface:IValueMapRetrieves anintegervalue by key.- Specified by:
getAsIntegerin interfaceIValueMap- 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
Description copied from interface:IValueMapRetrieves aLongvalue by key. -
getAsLong
Description copied from interface:IValueMapRetrieves alongvalue by key. -
getAsDouble
Description copied from interface:IValueMapRetrieves aDoublevalue by key.- Specified by:
getAsDoublein interfaceIValueMap- Parameters:
key- the key- Returns:
- the value or null if value is not a valid double or no value is in this
IValueMap
-
getAsDouble
Description copied from interface:IValueMapRetrieves adoublevalue by key.- Specified by:
getAsDoublein interfaceIValueMap- 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
Description copied from interface:IValueMapRetrieves aDurationvalue by key.- Specified by:
getAsDurationin interfaceIValueMap- Parameters:
key- the key- Returns:
- the value or null if value is not a valid Duration or no value is in this
IValueMap
-
getAsDuration
Description copied from interface:IValueMapRetrieves aDurationvalue by key.- Specified by:
getAsDurationin interfaceIValueMap- 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
Description copied from interface:IValueMapRetrieves aTimevalue by key.- Specified by:
getAsInstantin interfaceIValueMap- Parameters:
key- the key- Returns:
- the value or null if value is not a valid Time or no value is in this
IValueMap
-
getAsTime
Description copied from interface:IValueMapRetrieves aTimevalue by key. -
getAsEnum
Description copied from interface:IValueMapRetrieves anEnumvalue by key. -
getAsEnum
Description copied from interface:IValueMapRetrieves anEnumvalue by key. -
getAsEnum
Description copied from interface:IValueMapRetrieves anEnumvalue by key.- Specified by:
getAsEnumin interfaceIValueMap- 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
-