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 TypeMethodDescriptionvoid
clear()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) entrySet()
boolean
getAsBoolean
(String key) Retrieves aBoolean
value by key.boolean
getAsBoolean
(String key, boolean defaultValue) Retrieves aboolean
value by key.getAsDouble
(String key) Retrieves aDouble
value by key.double
getAsDouble
(String key, double defaultValue) Retrieves adouble
value by key.getAsDuration
(String key) Retrieves aDuration
value by key.getAsDuration
(String key, Duration defaultValue) Retrieves aDuration
value by key.<T extends Enum<T>>
TRetrieves anEnum
value by key.<T extends Enum<T>>
TRetrieves anEnum
value by key.<T extends Enum<T>>
TRetrieves anEnum
value by key.getAsInstant
(String key) Retrieves aTime
value by key.getAsInteger
(String key) Retrieves anInteger
value by key.int
getAsInteger
(String key, int defaultValue) Retrieves aninteger
value by key.Retrieves aLong
value by key.long
Retrieves along
value by key.Retrieves aTime
value by key.boolean
getBoolean
(String key) Retrieves aboolean
value by key.getCharSequence
(String key) Retrieves aCharSequence
by key.double
Retrieves adouble
value by key.double
Retrieves adouble
value by key, using a default value if not found.getDuration
(String key) Retrieves aDuration
by key.getInstant
(String key) Retrieves aInstant
object by key.int
Retrieves anint
value by key.int
Retrieves anint
value by key, using a default value if not found.Provided that the hash key is aString
and 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.long
Retrieves along
value by key.long
Retrieves along
value by key, using a default value if not found.Retrieves aString
by key.Retrieves aString
by key, using a default value if not found.String[]
getStringArray
(String key) Retrieves aString
array by key.getStringValue
(String key) Retrieves aStringValue
object by key.int
hashCode()
boolean
isEmpty()
boolean
Returns whether or not thisIValueMap
is immutable.keySet()
Makes thisIValueMap
immutable by changing the underlying map representation to aCollections.unmodifiableMap
.void
int
size()
values()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods 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:
containsKey
in interfaceMap<String,
Object>
-
containsValue
- Specified by:
containsValue
in interfaceMap<String,
Object>
-
entrySet
-
equals
-
hashCode
-
get
-
getBoolean
Description copied from interface:IValueMap
Retrieves aboolean
value by key.- Specified by:
getBoolean
in interfaceIValueMap
- Parameters:
key
- the key- Returns:
- the value
- Throws:
StringValueConversionException
-
getCharSequence
Description copied from interface:IValueMap
Retrieves aCharSequence
by key.- Specified by:
getCharSequence
in interfaceIValueMap
- Parameters:
key
- the key- Returns:
- the
CharSequence
-
getDouble
Description copied from interface:IValueMap
Retrieves adouble
value by key.- Specified by:
getDouble
in interfaceIValueMap
- Parameters:
key
- the key- Returns:
- the value
- Throws:
StringValueConversionException
-
getDouble
Description copied from interface:IValueMap
Retrieves adouble
value by key, using a default value if not found. -
getDuration
Description copied from interface:IValueMap
Retrieves aDuration
by key.- Specified by:
getDuration
in interfaceIValueMap
- Parameters:
key
- the key- Returns:
- the
Duration
value - Throws:
StringValueConversionException
-
getInt
Description copied from interface:IValueMap
Retrieves anint
value by key, using a default value if not found. -
getInt
Description copied from interface:IValueMap
Retrieves anint
value by key.- Specified by:
getInt
in interfaceIValueMap
- Parameters:
key
- the key- Returns:
- the value
- Throws:
StringValueConversionException
-
getKey
Description copied from interface:IValueMap
Provided that the hash key is aString
and 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:IValueMap
Retrieves along
value by key, using a default value if not found. -
getLong
Description copied from interface:IValueMap
Retrieves along
value by key.- Specified by:
getLong
in interfaceIValueMap
- Parameters:
key
- the key- Returns:
- the value
- Throws:
StringValueConversionException
-
getString
Description copied from interface:IValueMap
Retrieves aString
by key, using a default value if not found. -
getString
Description copied from interface:IValueMap
Retrieves aString
by key. -
getStringArray
Description copied from interface:IValueMap
Retrieves aString
array by key. If the value was aString[]
it will be returned directly. If it was aString
it will be converted to aString
array of length one. If it was an array of another type, aString
array will be made and each element will be converted to aString
.- Specified by:
getStringArray
in interfaceIValueMap
- Parameters:
key
- the key- Returns:
- the
String
array of that key
-
getStringValue
Description copied from interface:IValueMap
Retrieves aStringValue
object by key.- Specified by:
getStringValue
in interfaceIValueMap
- Parameters:
key
- the key- Returns:
- the
StringValue
object
-
getInstant
Description copied from interface:IValueMap
Retrieves aInstant
object by key.- Specified by:
getInstant
in interfaceIValueMap
- Parameters:
key
- the key- Returns:
- the
Instant
object - Throws:
StringValueConversionException
-
isEmpty
-
isImmutable
Description copied from interface:IValueMap
Returns whether or not thisIValueMap
is immutable.- Specified by:
isImmutable
in interfaceIValueMap
- Returns:
- whether or not this
IValueMap
is immutable
-
keySet
-
makeImmutable
Description copied from interface:IValueMap
Makes thisIValueMap
immutable by changing the underlying map representation to aCollections.unmodifiableMap
. After calling this method, any attempt to modify thisIValueMap
will result in aRuntimeException
being thrown by theCollections
framework.- Specified by:
makeImmutable
in interfaceIValueMap
- Returns:
- this
IValueMap
-
put
-
putAll
-
remove
-
size
-
values
-
getAsBoolean
Description copied from interface:IValueMap
Retrieves aBoolean
value by key.- Specified by:
getAsBoolean
in 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:IValueMap
Retrieves aboolean
value by key.- Specified by:
getAsBoolean
in 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:IValueMap
Retrieves anInteger
value by key.- Specified by:
getAsInteger
in 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:IValueMap
Retrieves aninteger
value by key.- Specified by:
getAsInteger
in 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:IValueMap
Retrieves aLong
value by key. -
getAsLong
Description copied from interface:IValueMap
Retrieves along
value by key. -
getAsDouble
Description copied from interface:IValueMap
Retrieves aDouble
value by key.- Specified by:
getAsDouble
in 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:IValueMap
Retrieves adouble
value by key.- Specified by:
getAsDouble
in 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:IValueMap
Retrieves aDuration
value by key.- Specified by:
getAsDuration
in 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:IValueMap
Retrieves aDuration
value by key.- Specified by:
getAsDuration
in 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:IValueMap
Retrieves aTime
value by key.- Specified by:
getAsInstant
in 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:IValueMap
Retrieves aTime
value by key. -
getAsEnum
Description copied from interface:IValueMap
Retrieves anEnum
value by key. -
getAsEnum
Description copied from interface:IValueMap
Retrieves anEnum
value by key. -
getAsEnum
Description copied from interface:IValueMap
Retrieves anEnum
value by key.- Specified by:
getAsEnum
in 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
-