Package org.apache.wicket.util.value
Interface IValueMap
-
- All Known Implementing Classes:
AttributeMap,CopyOnWriteValueMap,ValueMap
public interface IValueMap extends Map<String,Object>
AMapinterface that holds values, parsesStrings, and exposes a variety of convenience methods.- Since:
- 1.2.6
- Author:
- Johan Compagner, Doug Donohoe
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description BooleangetAsBoolean(String key)Retrieves aBooleanvalue by key.booleangetAsBoolean(String key, boolean defaultValue)Retrieves abooleanvalue by key.DoublegetAsDouble(String key)Retrieves aDoublevalue by key.doublegetAsDouble(String key, double defaultValue)Retrieves adoublevalue by key.DurationgetAsDuration(String key)Retrieves aDurationvalue by key.DurationgetAsDuration(String key, Duration defaultValue)Retrieves aDurationvalue by key.<T extends Enum<T>>
TgetAsEnum(String key, Class<T> eClass)Retrieves anEnumvalue by key.<T extends Enum<T>>
TgetAsEnum(String key, Class<T> eClass, T defaultValue)Retrieves anEnumvalue by key.<T extends Enum<T>>
TgetAsEnum(String key, T defaultValue)Retrieves anEnumvalue by key.InstantgetAsInstant(String key)Retrieves aTimevalue by key.IntegergetAsInteger(String key)Retrieves anIntegervalue by key.intgetAsInteger(String key, int defaultValue)Retrieves anintegervalue by key.LonggetAsLong(String key)Retrieves aLongvalue by key.longgetAsLong(String key, long defaultValue)Retrieves alongvalue by key.InstantgetAsTime(String key, Instant defaultValue)Retrieves aTimevalue by key.booleangetBoolean(String key)Retrieves abooleanvalue by key.CharSequencegetCharSequence(String key)Retrieves aCharSequenceby key.doublegetDouble(String key)Retrieves adoublevalue by key.doublegetDouble(String key, double defaultValue)Retrieves adoublevalue by key, using a default value if not found.DurationgetDuration(String key)Retrieves aDurationby key.InstantgetInstant(String key)Retrieves aInstantobject by key.intgetInt(String key)Retrieves anintvalue by key.intgetInt(String key, int defaultValue)Retrieves anintvalue by key, using a default value if not found.StringgetKey(String key)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.longgetLong(String key)Retrieves alongvalue by key.longgetLong(String key, long defaultValue)Retrieves alongvalue by key, using a default value if not found.StringgetString(String key)Retrieves aStringby key.StringgetString(String key, String defaultValue)Retrieves aStringby key, using a default value if not found.String[]getStringArray(String key)Retrieves aStringarray by key.StringValuegetStringValue(String key)Retrieves aStringValueobject by key.booleanisImmutable()Returns whether or not thisIValueMapis immutable.IValueMapmakeImmutable()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 Detail
-
getBoolean
boolean getBoolean(String key) throws StringValueConversionException
Retrieves abooleanvalue by key.- Parameters:
key- the key- Returns:
- the value
- Throws:
StringValueConversionException
-
getDouble
double getDouble(String key) throws StringValueConversionException
Retrieves adoublevalue by key.- Parameters:
key- the key- Returns:
- the value
- Throws:
StringValueConversionException
-
getDouble
double getDouble(String key, double defaultValue) throws StringValueConversionException
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
Duration getDuration(String key) throws StringValueConversionException
Retrieves aDurationby key.- Parameters:
key- the key- Returns:
- the
Durationvalue - Throws:
StringValueConversionException
-
getInt
int getInt(String key) throws StringValueConversionException
Retrieves anintvalue by key.- Parameters:
key- the key- Returns:
- the value
- Throws:
StringValueConversionException
-
getInt
int getInt(String key, int defaultValue) throws StringValueConversionException
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
long getLong(String key) throws StringValueConversionException
Retrieves alongvalue by key.- Parameters:
key- the key- Returns:
- the value
- Throws:
StringValueConversionException
-
getLong
long getLong(String key, long defaultValue) throws StringValueConversionException
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
String getString(String key, String defaultValue)
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
String getString(String key)
Retrieves aStringby key.- Parameters:
key- the key- Returns:
- the
String
-
getCharSequence
CharSequence getCharSequence(String key)
Retrieves aCharSequenceby key.- Parameters:
key- the key- Returns:
- the
CharSequence
-
getStringArray
String[] getStringArray(String key)
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
StringValue getStringValue(String key)
Retrieves aStringValueobject by key.- Parameters:
key- the key- Returns:
- the
StringValueobject
-
getInstant
Instant getInstant(String key) throws StringValueConversionException
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
IValueMap 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
String getKey(String key)
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
Boolean getAsBoolean(String key)
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
boolean getAsBoolean(String key, boolean defaultValue)
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
Integer getAsInteger(String key)
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
int getAsInteger(String key, int defaultValue)
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
Long getAsLong(String key)
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
long getAsLong(String key, long defaultValue)
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
Double getAsDouble(String key)
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
double getAsDouble(String key, double defaultValue)
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
Duration getAsDuration(String key)
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
Duration getAsDuration(String key, Duration defaultValue)
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
Instant getAsInstant(String key)
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
Instant getAsTime(String key, Instant defaultValue)
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
<T extends Enum<T>> T getAsEnum(String key, Class<T> eClass)
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
<T extends Enum<T>> T getAsEnum(String key, T defaultValue)
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
<T extends Enum<T>> T getAsEnum(String key, Class<T> eClass, T defaultValue)
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
-
-