public interface IValueMap extends Map<String,Object>
Map
interface that holds values, parses String
s, and exposes a
variety of convenience methods.Modifier and Type | Method and Description |
---|---|
Boolean |
getAsBoolean(String key)
Retrieves a
Boolean value by key. |
boolean |
getAsBoolean(String key,
boolean defaultValue)
Retrieves a
boolean value by key. |
Double |
getAsDouble(String key)
Retrieves a
Double value by key. |
double |
getAsDouble(String key,
double defaultValue)
Retrieves a
double value by key. |
Duration |
getAsDuration(String key)
Retrieves a
Duration value by key. |
Duration |
getAsDuration(String key,
Duration defaultValue)
Retrieves a
Duration value by key. |
<T extends Enum<T>> |
getAsEnum(String key,
Class<T> eClass)
Retrieves an
Enum value by key. |
<T extends Enum<T>> |
getAsEnum(String key,
Class<T> eClass,
T defaultValue)
Retrieves an
Enum value by key. |
<T extends Enum<T>> |
getAsEnum(String key,
T defaultValue)
Retrieves an
Enum value by key. |
Integer |
getAsInteger(String key)
Retrieves an
Integer value by key. |
int |
getAsInteger(String key,
int defaultValue)
Retrieves an
integer value by key. |
Long |
getAsLong(String key)
Retrieves a
Long value by key. |
long |
getAsLong(String key,
long defaultValue)
Retrieves a
long value by key. |
Time |
getAsTime(String key)
Retrieves a
Time value by key. |
Time |
getAsTime(String key,
Time defaultValue)
Retrieves a
Time value by key. |
boolean |
getBoolean(String key)
Retrieves a
boolean value by key. |
CharSequence |
getCharSequence(String key)
Retrieves a
CharSequence by key. |
double |
getDouble(String key)
Retrieves a
double value by key. |
double |
getDouble(String key,
double defaultValue)
Retrieves a
double value by key, using a default value if not found. |
Duration |
getDuration(String key)
Retrieves a
Duration by key. |
int |
getInt(String key)
Retrieves an
int value by key. |
int |
getInt(String key,
int defaultValue)
Retrieves an
int value by key, using a default value if not found. |
String |
getKey(String key)
Provided that the hash key is a
String 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 |
getLong(String key)
Retrieves a
long value by key. |
long |
getLong(String key,
long defaultValue)
Retrieves a
long value by key, using a default value if not found. |
String |
getString(String key)
Retrieves a
String by key. |
String |
getString(String key,
String defaultValue)
Retrieves a
String by key, using a default value if not found. |
String[] |
getStringArray(String key)
Retrieves a
String array by key. |
StringValue |
getStringValue(String key)
Retrieves a
StringValue object by key. |
Time |
getTime(String key)
Retrieves a
Time object by key. |
boolean |
isImmutable()
Returns whether or not this
IValueMap is immutable. |
IValueMap |
makeImmutable()
Makes this
IValueMap immutable by changing the underlying map representation to
a Collections.unmodifiableMap . |
boolean getBoolean(String key) throws StringValueConversionException
boolean
value by key.key
- the keyStringValueConversionException
double getDouble(String key) throws StringValueConversionException
double
value by key.key
- the keyStringValueConversionException
double getDouble(String key, double defaultValue) throws StringValueConversionException
double
value by key, using a default value if not found.key
- the keydefaultValue
- value to use if no value is in this IValueMap
StringValueConversionException
Duration getDuration(String key) throws StringValueConversionException
Duration
by key.key
- the keyDuration
valueStringValueConversionException
int getInt(String key) throws StringValueConversionException
int
value by key.key
- the keyStringValueConversionException
int getInt(String key, int defaultValue) throws StringValueConversionException
int
value by key, using a default value if not found.key
- the keydefaultValue
- value to use if no value is in this IValueMap
StringValueConversionException
long getLong(String key) throws StringValueConversionException
long
value by key.key
- the keyStringValueConversionException
long getLong(String key, long defaultValue) throws StringValueConversionException
long
value by key, using a default value if not found.key
- the keydefaultValue
- value to use if no value in this IValueMap
StringValueConversionException
String getString(String key, String defaultValue)
String
by key, using a default value if not found.key
- the keydefaultValue
- default value to return if value is null
String
String getString(String key)
String
by key.key
- the keyString
CharSequence getCharSequence(String key)
CharSequence
by key.key
- the keyCharSequence
String[] getStringArray(String key)
String
array by key. If the value was a String[]
it
will be returned directly. If it was a String
it will be converted to a
String
array of length one. If it was an array of another type, a
String
array will be made and each element will be converted to a
String
.key
- the keyString
array of that keyStringValue getStringValue(String key)
StringValue
object by key.key
- the keyStringValue
objectTime getTime(String key) throws StringValueConversionException
Time
object by key.key
- the keyTime
objectStringValueConversionException
boolean isImmutable()
IValueMap
is immutable.IValueMap
is immutableIValueMap makeImmutable()
IValueMap
immutable by changing the underlying map representation to
a Collections.unmodifiableMap
. After calling this method, any attempt to modify
this IValueMap
will result in a RuntimeException
being thrown by
the Collections
framework.IValueMap
String getKey(String key)
String
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.key
- the keyBoolean getAsBoolean(String key)
Boolean
value by key.key
- the keyIValueMap
boolean getAsBoolean(String key, boolean defaultValue)
boolean
value by key.key
- the keydefaultValue
- the default to returnIValueMap
Integer getAsInteger(String key)
Integer
value by key.key
- the keyIValueMap
int getAsInteger(String key, int defaultValue)
integer
value by key.key
- the keydefaultValue
- the default to returnIValueMap
Long getAsLong(String key)
Long
value by key.key
- the keyIValueMap
long getAsLong(String key, long defaultValue)
long
value by key.key
- the keydefaultValue
- the default to returnIValueMap
Double getAsDouble(String key)
Double
value by key.key
- the keyIValueMap
double getAsDouble(String key, double defaultValue)
double
value by key.key
- the keydefaultValue
- the default to returnIValueMap
Duration getAsDuration(String key)
Duration
value by key.key
- the keyIValueMap
Duration getAsDuration(String key, Duration defaultValue)
Duration
value by key.key
- the keydefaultValue
- the default to returnIValueMap
Time getAsTime(String key)
Time
value by key.key
- the keyIValueMap
Time getAsTime(String key, Time defaultValue)
Time
value by key.key
- the keydefaultValue
- the default to returnIValueMap
<T extends Enum<T>> T getAsEnum(String key, Class<T> eClass)
Enum
value by key.T
- type of enumkey
- the keyeClass
- the enumeration classIValueMap
<T extends Enum<T>> T getAsEnum(String key, T defaultValue)
Enum
value by key.T
- type of enumkey
- the keydefaultValue
- the default value from the Enumeration (cannot be null)IValueMap
<T extends Enum<T>> T getAsEnum(String key, Class<T> eClass, T defaultValue)
Enum
value by key.T
- type of enumkey
- the keyeClass
- the enumeration classdefaultValue
- the default value from the Enumeration (may be null)IValueMap
Copyright © 2006–2021 Apache Software Foundation. All rights reserved.