public class DataConfiguration extends AbstractConfiguration implements Serializable
URL
Locale
Date
Calendar
Color
InetAddress
InternetAddress
(requires Javamail in the classpath)Enum
(Java 5 enumeration types)title.color = #0000FF remote.host = 192.168.0.53 default.locales = fr,en,de email.contact = ebourg@apache.org, oheger@apache.orgUsage:
DataConfiguration config = new DataConfiguration(new PropertiesConfiguration("config.properties")); // retrieve a property using a specialized getter Color color = config.getColor("title.color"); // retrieve a property using a generic getter InetAddress host = (InetAddress) config.get(InetAddress.class, "remote.host"); Locale[] locales = (Locale[]) config.getArray(Locale.class, "default.locales"); List contacts = config.getList(InternetAddress.class, "email.contact");
Modifier and Type | Field and Description |
---|---|
protected Configuration |
configuration
Stores the wrapped configuration.
|
static String |
DATE_FORMAT_KEY
The key of the property storing the user defined date format.
|
static String |
DEFAULT_DATE_FORMAT
The default format for dates.
|
END_TOKEN, EVENT_ADD_PROPERTY, EVENT_CLEAR, EVENT_CLEAR_PROPERTY, EVENT_READ_PROPERTY, EVENT_SET_PROPERTY, START_TOKEN
Constructor and Description |
---|
DataConfiguration(Configuration configuration)
Creates a new instance of
DataConfiguration and sets the
wrapped configuration. |
Modifier and Type | Method and Description |
---|---|
void |
addProperty(String key,
Object value)
Add a property to the configuration.
|
protected void |
addPropertyDirect(String key,
Object obj)
Adds a key/value pair to the Configuration.
|
void |
clearProperty(String key)
Removes the specified property from this configuration.
|
boolean |
containsKey(String key)
Check if the configuration contains the specified key.
|
<T> T |
get(Class<T> cls,
String key)
Get an object of the specified type associated with the given
configuration key.
|
<T> T |
get(Class<T> cls,
String key,
T defaultValue)
Get an object of the specified type associated with the given
configuration key.
|
Object |
getArray(Class<?> cls,
String key)
Get an array of typed objects associated with the given configuration key.
|
Object |
getArray(Class<?> cls,
String key,
Object defaultValue)
Get an array of typed objects associated with the given configuration key.
|
BigDecimal[] |
getBigDecimalArray(String key)
Get an array of BigDecimals associated with the given
configuration key.
|
BigDecimal[] |
getBigDecimalArray(String key,
BigDecimal[] defaultValue)
Get an array of BigDecimals associated with the given
configuration key.
|
List<BigDecimal> |
getBigDecimalList(String key)
Get a list of BigDecimals associated with the given configuration key.
|
List<BigDecimal> |
getBigDecimalList(String key,
List<BigDecimal> defaultValue)
Get a list of BigDecimals associated with the given configuration key.
|
BigInteger[] |
getBigIntegerArray(String key)
Get an array of BigIntegers associated with the given
configuration key.
|
BigInteger[] |
getBigIntegerArray(String key,
BigInteger[] defaultValue)
Get an array of BigIntegers associated with the given
configuration key.
|
List<BigInteger> |
getBigIntegerList(String key)
Get a list of BigIntegers associated with the given configuration key.
|
List<BigInteger> |
getBigIntegerList(String key,
List<BigInteger> defaultValue)
Get a list of BigIntegers associated with the given configuration key.
|
boolean[] |
getBooleanArray(String key)
Get an array of boolean primitives associated with the given
configuration key.
|
boolean[] |
getBooleanArray(String key,
boolean[] defaultValue)
Get an array of boolean primitives associated with the given
configuration key.
|
List<Boolean> |
getBooleanList(String key)
Get a list of Boolean objects associated with the given
configuration key.
|
List<Boolean> |
getBooleanList(String key,
List<Boolean> defaultValue)
Get a list of Boolean objects associated with the given
configuration key.
|
byte[] |
getByteArray(String key)
Get an array of byte primitives associated with the given
configuration key.
|
byte[] |
getByteArray(String key,
byte[] defaultValue)
Get an array of byte primitives associated with the given
configuration key.
|
List<Byte> |
getByteList(String key)
Get a list of Byte objects associated with the given configuration key.
|
List<Byte> |
getByteList(String key,
List<Byte> defaultValue)
Get a list of Byte objects associated with the given configuration key.
|
Calendar |
getCalendar(String key)
Get a Calendar associated with the given configuration key.
|
Calendar |
getCalendar(String key,
Calendar defaultValue)
Get a Calendar associated with the given configuration key.
|
Calendar |
getCalendar(String key,
Calendar defaultValue,
String format)
Get a Calendar associated with the given configuration key.
|
Calendar |
getCalendar(String key,
String format)
Get a Calendar associated with the given configuration key.
|
Calendar[] |
getCalendarArray(String key)
Get an array of Calendars associated with the given configuration key.
|
Calendar[] |
getCalendarArray(String key,
Calendar[] defaultValue)
Get an array of Calendars associated with the given configuration key.
|
Calendar[] |
getCalendarArray(String key,
Calendar[] defaultValue,
String format)
Get an array of Calendars associated with the given configuration key.
|
Calendar[] |
getCalendarArray(String key,
String format)
Get an array of Calendars associated with the given configuration key.
|
List<Calendar> |
getCalendarList(String key)
Get a list of Calendars associated with the given configuration key.
|
List<Calendar> |
getCalendarList(String key,
List<Calendar> defaultValue)
Get a list of Calendars associated with the given configuration key.
|
List<Calendar> |
getCalendarList(String key,
List<Calendar> defaultValue,
String format)
Get a list of Calendars associated with the given configuration key.
|
List<Calendar> |
getCalendarList(String key,
String format)
Get a list of Calendars associated with the given configuration key.
|
Color |
getColor(String key)
Get a Color associated with the given configuration key.
|
Color |
getColor(String key,
Color defaultValue)
Get a Color associated with the given configuration key.
|
Color[] |
getColorArray(String key)
Get an array of Colors associated with the given
configuration key.
|
Color[] |
getColorArray(String key,
Color[] defaultValue)
Get an array of Colors associated with the given
configuration key.
|
List<Color> |
getColorList(String key)
Get a list of Colors associated with the given configuration key.
|
List<Color> |
getColorList(String key,
List<Color> defaultValue)
Get a list of Colors associated with the given configuration key.
|
Configuration |
getConfiguration()
Return the configuration decorated by this DataConfiguration.
|
Date |
getDate(String key)
Get a Date associated with the given configuration key.
|
Date |
getDate(String key,
Date defaultValue)
Get a Date associated with the given configuration key.
|
Date |
getDate(String key,
Date defaultValue,
String format)
Get a Date associated with the given configuration key.
|
Date |
getDate(String key,
String format)
Get a Date associated with the given configuration key.
|
Date[] |
getDateArray(String key)
Get an array of Dates associated with the given configuration key.
|
Date[] |
getDateArray(String key,
Date[] defaultValue)
Get an array of Dates associated with the given configuration key.
|
Date[] |
getDateArray(String key,
Date[] defaultValue,
String format)
Get an array of Dates associated with the given configuration key.
|
Date[] |
getDateArray(String key,
String format)
Get an array of Dates associated with the given configuration key.
|
List<Date> |
getDateList(String key) |
List<Date> |
getDateList(String key,
List<Date> defaultValue)
Get a list of Dates associated with the given configuration key.
|
List<Date> |
getDateList(String key,
List<Date> defaultValue,
String format)
Get a list of Dates associated with the given configuration key.
|
List<Date> |
getDateList(String key,
String format)
Get a list of Dates associated with the given configuration key.
|
double[] |
getDoubleArray(String key)
Get an array of double primitives associated with the given
configuration key.
|
double[] |
getDoubleArray(String key,
double[] defaultValue)
Get an array of double primitives associated with the given
configuration key.
|
List<Double> |
getDoubleList(String key)
Get a list of Double objects associated with the given
configuration key.
|
List<Double> |
getDoubleList(String key,
List<Double> defaultValue)
Get a list of Double objects associated with the given
configuration key.
|
float[] |
getFloatArray(String key)
Get an array of float primitives associated with the given
configuration key.
|
float[] |
getFloatArray(String key,
float[] defaultValue)
Get an array of float primitives associated with the given
configuration key.
|
List<Float> |
getFloatList(String key)
Get a list of Float objects associated with the given configuration key.
|
List<Float> |
getFloatList(String key,
List<Float> defaultValue)
Get a list of Float objects associated with the given
configuration key.
|
int[] |
getIntArray(String key)
Get an array of int primitives associated with the given
configuration key.
|
int[] |
getIntArray(String key,
int[] defaultValue)
Get an array of int primitives associated with the given
configuration key.
|
List<Integer> |
getIntegerList(String key)
Get a list of Integer objects associated with the given
configuration key.
|
List<Integer> |
getIntegerList(String key,
List<Integer> defaultValue)
Get a list of Integer objects associated with the given
configuration key.
|
Iterator<String> |
getKeys()
Get the list of the keys contained in the configuration.
|
<T> List<T> |
getList(Class<T> cls,
String key)
Get a list of typed objects associated with the given configuration key.
|
<T> List<T> |
getList(Class<T> cls,
String key,
List<T> defaultValue)
Get a list of typed objects associated with the given configuration key.
|
Locale |
getLocale(String key)
Get a Locale associated with the given configuration key.
|
Locale |
getLocale(String key,
Locale defaultValue)
Get a Locale associated with the given configuration key.
|
Locale[] |
getLocaleArray(String key)
Get an array of Locales associated with the given
configuration key.
|
Locale[] |
getLocaleArray(String key,
Locale[] defaultValue)
Get an array of Locales associated with the given
configuration key.
|
List<Locale> |
getLocaleList(String key)
Get a list of Locales associated with the given configuration key.
|
List<Locale> |
getLocaleList(String key,
List<Locale> defaultValue)
Get a list of Locales associated with the given configuration key.
|
long[] |
getLongArray(String key)
Get an array of long primitives associated with the given
configuration key.
|
long[] |
getLongArray(String key,
long[] defaultValue)
Get an array of long primitives associated with the given
configuration key.
|
List<Long> |
getLongList(String key)
Get a list of Long objects associated with the given configuration key.
|
List<Long> |
getLongList(String key,
List<Long> defaultValue)
Get a list of Long objects associated with the given configuration key.
|
Object |
getProperty(String key)
Gets a property from the configuration.
|
short[] |
getShortArray(String key)
Get an array of short primitives associated with the given
configuration key.
|
short[] |
getShortArray(String key,
short[] defaultValue)
Get an array of short primitives associated with the given
configuration key.
|
List<Short> |
getShortList(String key)
Get a list of Short objects associated with the given configuration key.
|
List<Short> |
getShortList(String key,
List<Short> defaultValue)
Get a list of Short objects associated with the given configuration key.
|
URL |
getURL(String key)
Get an URL associated with the given configuration key.
|
URL |
getURL(String key,
URL defaultValue)
Get an URL associated with the given configuration key.
|
URL[] |
getURLArray(String key)
Get an array of URLs associated with the given configuration key.
|
URL[] |
getURLArray(String key,
URL[] defaultValue)
Get an array of URLs associated with the given configuration key.
|
List<URL> |
getURLList(String key)
Get a list of URLs associated with the given configuration key.
|
List<URL> |
getURLList(String key,
List<URL> defaultValue)
Get a list of URLs associated with the given configuration key.
|
boolean |
isEmpty()
Check if the configuration is empty.
|
void |
setProperty(String key,
Object value)
Set a property, this will replace any previously set values.
|
addErrorLogListener, append, clear, clearPropertyDirect, copy, createInterpolator, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getDefaultListDelimiter, getDelimiter, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getInterpolator, getKeys, getList, getList, getListDelimiter, getLogger, getLong, getLong, getLong, getProperties, getProperties, getShort, getShort, getShort, getString, getString, getStringArray, getSubstitutor, interpolate, interpolate, interpolatedConfiguration, interpolateHelper, isDelimiterParsingDisabled, isScalarValue, isThrowExceptionOnMissing, resolveContainerStore, setDefaultListDelimiter, setDelimiter, setDelimiterParsingDisabled, setListDelimiter, setLogger, setThrowExceptionOnMissing, subset
addConfigurationListener, addErrorListener, clearConfigurationListeners, clearErrorListeners, clone, createErrorEvent, createEvent, fireError, fireEvent, getConfigurationListeners, getErrorListeners, isDetailEvents, removeConfigurationListener, removeErrorListener, setDetailEvents
public static final String DATE_FORMAT_KEY
public static final String DEFAULT_DATE_FORMAT
protected Configuration configuration
public DataConfiguration(Configuration configuration)
DataConfiguration
and sets the
wrapped configuration.configuration
- the wrapped configurationpublic Configuration getConfiguration()
public Object getProperty(String key)
Configuration
Configuration
interface the other get methods (that
return specific data types) will internally make use of this method. On
this level variable substitution is not yet performed. The returned
object is an internal representation of the property value for the passed
in key. It is owned by the Configuration
object. So a caller
should not modify this object. It cannot be guaranteed that this object
will stay constant over time (i.e. further update operations on the
configuration may change its internal state).getProperty
in interface Configuration
key
- property to retrieveprotected void addPropertyDirect(String key, Object obj)
AbstractConfiguration
addPropertyDirect
in class AbstractConfiguration
key
- key to use for mappingobj
- object to storepublic void addProperty(String key, Object value)
Configuration
resource.loader = fileis already present in the configuration and you call
addProperty("resource.loader", "classpath")Then you will end up with a List like the following:
["file", "classpath"]
addProperty
in interface Configuration
addProperty
in class AbstractConfiguration
key
- The key to add the property to.value
- The value to add.public boolean isEmpty()
Configuration
isEmpty
in interface Configuration
true
if the configuration contains no property,
false
otherwise.public boolean containsKey(String key)
Configuration
containsKey
in interface Configuration
key
- the key whose presence in this configuration is to be testedtrue
if the configuration contains a value for this
key, false
otherwisepublic void clearProperty(String key)
AbstractConfiguration
clearPropertyDirect()
, which will do the real work.clearProperty
in interface Configuration
clearProperty
in class AbstractConfiguration
key
- the key to be removedpublic void setProperty(String key, Object value)
Configuration
setProperty
in interface Configuration
setProperty
in class AbstractConfiguration
key
- The key of the property to changevalue
- The new valuepublic Iterator<String> getKeys()
Configuration
remove()
method is specific to
a concrete implementation. It may remove the corresponding
property from the configuration, but this is not guaranteed. In any case
it is no replacement for calling
Configuration.clearProperty(String)
for this property. So it is
highly recommended to avoid using the iterator's remove()
method.getKeys
in interface Configuration
public <T> T get(Class<T> cls, String key)
AbstractConfiguration.isThrowExceptionOnMissing()
is set
to true.T
- the target type of the valuecls
- the target class of the valuekey
- the key of the valueNoSuchElementException
- if the key doesn't map to an existing
object and throwExceptionOnMissing=trueConversionException
- if the value is not compatible with the requested typepublic <T> T get(Class<T> cls, String key, T defaultValue)
T
- the target type of the valuecls
- the target class of the valuekey
- the key of the valuedefaultValue
- the default valueConversionException
- if the value is not compatible with the requested typepublic <T> List<T> getList(Class<T> cls, String key)
T
- the type expected for the elements of the listcls
- the class expected for the elements of the listkey
- The configuration key.ConversionException
- is thrown if the key maps to an object that
is not compatible with a list of the specified class.public <T> List<T> getList(Class<T> cls, String key, List<T> defaultValue)
T
- the type expected for the elements of the listcls
- the class expected for the elements of the listkey
- the configuration key.defaultValue
- the default value.ConversionException
- is thrown if the key maps to an object that
is not compatible with a list of the specified class.public Object getArray(Class<?> cls, String key)
cls
- the type expected for the elements of the arraykey
- The configuration key.ConversionException
- is thrown if the key maps to an object that
is not compatible with a list of the specified class.public Object getArray(Class<?> cls, String key, Object defaultValue)
cls
- the type expected for the elements of the arraykey
- the configuration key.defaultValue
- the default valueConversionException
- is thrown if the key maps to an object that
is not compatible with an array of the specified class.IllegalArgumentException
- if the default value is not an array of the specified typepublic List<Boolean> getBooleanList(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of booleans.public List<Boolean> getBooleanList(String key, List<Boolean> defaultValue)
key
- The configuration key.defaultValue
- The default value.ConversionException
- is thrown if the key maps to an
object that is not a list of booleans.public boolean[] getBooleanArray(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of booleans.public boolean[] getBooleanArray(String key, boolean[] defaultValue)
key
- The configuration key.defaultValue
- The default value.ConversionException
- is thrown if the key maps to an
object that is not a list of booleans.public List<Byte> getByteList(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of bytes.public List<Byte> getByteList(String key, List<Byte> defaultValue)
key
- The configuration key.defaultValue
- The default value.ConversionException
- is thrown if the key maps to an
object that is not a list of bytes.public byte[] getByteArray(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of bytes.public byte[] getByteArray(String key, byte[] defaultValue)
key
- The configuration key.defaultValue
- the default value, which will be returned if the property is not foundConversionException
- is thrown if the key maps to an
object that is not a list of bytes.public List<Short> getShortList(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of shorts.public List<Short> getShortList(String key, List<Short> defaultValue)
key
- The configuration key.defaultValue
- The default value.ConversionException
- is thrown if the key maps to an
object that is not a list of shorts.public short[] getShortArray(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of shorts.public short[] getShortArray(String key, short[] defaultValue)
key
- The configuration key.defaultValue
- the default value, which will be returned if the property is not foundConversionException
- is thrown if the key maps to an
object that is not a list of shorts.public List<Integer> getIntegerList(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of integers.public List<Integer> getIntegerList(String key, List<Integer> defaultValue)
key
- The configuration key.defaultValue
- The default value.ConversionException
- is thrown if the key maps to an
object that is not a list of integers.public int[] getIntArray(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of integers.public int[] getIntArray(String key, int[] defaultValue)
key
- The configuration key.defaultValue
- the default value, which will be returned if the property is not foundConversionException
- is thrown if the key maps to an
object that is not a list of integers.public List<Long> getLongList(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of longs.public List<Long> getLongList(String key, List<Long> defaultValue)
key
- The configuration key.defaultValue
- The default value.ConversionException
- is thrown if the key maps to an
object that is not a list of longs.public long[] getLongArray(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of longs.public long[] getLongArray(String key, long[] defaultValue)
key
- The configuration key.defaultValue
- the default value, which will be returned if the property is not foundConversionException
- is thrown if the key maps to an
object that is not a list of longs.public List<Float> getFloatList(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of floats.public List<Float> getFloatList(String key, List<Float> defaultValue)
key
- The configuration key.defaultValue
- The default value.ConversionException
- is thrown if the key maps to an
object that is not a list of floats.public float[] getFloatArray(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of floats.public float[] getFloatArray(String key, float[] defaultValue)
key
- The configuration key.defaultValue
- the default value, which will be returned if the property is not foundConversionException
- is thrown if the key maps to an
object that is not a list of floats.public List<Double> getDoubleList(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of doubles.public List<Double> getDoubleList(String key, List<Double> defaultValue)
key
- The configuration key.defaultValue
- The default value.ConversionException
- is thrown if the key maps to an
object that is not a list of doubles.public double[] getDoubleArray(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of doubles.public double[] getDoubleArray(String key, double[] defaultValue)
key
- The configuration key.defaultValue
- the default value, which will be returned if the property is not foundConversionException
- is thrown if the key maps to an
object that is not a list of doubles.public List<BigInteger> getBigIntegerList(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of BigIntegers.public List<BigInteger> getBigIntegerList(String key, List<BigInteger> defaultValue)
key
- The configuration key.defaultValue
- The default value.ConversionException
- is thrown if the key maps to an
object that is not a list of BigIntegers.public BigInteger[] getBigIntegerArray(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of BigIntegers.public BigInteger[] getBigIntegerArray(String key, BigInteger[] defaultValue)
key
- The configuration key.defaultValue
- the default value, which will be returned if the property is not foundConversionException
- is thrown if the key maps to an
object that is not a list of BigIntegers.public List<BigDecimal> getBigDecimalList(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of BigDecimals.public List<BigDecimal> getBigDecimalList(String key, List<BigDecimal> defaultValue)
key
- The configuration key.defaultValue
- The default value.ConversionException
- is thrown if the key maps to an
object that is not a list of BigDecimals.public BigDecimal[] getBigDecimalArray(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of BigDecimals.public BigDecimal[] getBigDecimalArray(String key, BigDecimal[] defaultValue)
key
- The configuration key.defaultValue
- the default value, which will be returned if the property is not foundConversionException
- is thrown if the key maps to an
object that is not a list of BigDecimals.public URL getURL(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not an URL.public URL getURL(String key, URL defaultValue)
key
- The configuration key.defaultValue
- The default value.ConversionException
- is thrown if the key maps to an
object that is not an URL.public List<URL> getURLList(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of URLs.public List<URL> getURLList(String key, List<URL> defaultValue)
key
- The configuration key.defaultValue
- The default value.ConversionException
- is thrown if the key maps to an
object that is not a list of URLs.public URL[] getURLArray(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of URLs.public URL[] getURLArray(String key, URL[] defaultValue)
key
- The configuration key.defaultValue
- the default value, which will be returned if the property is not foundConversionException
- is thrown if the key maps to an
object that is not a list of URLs.public Date getDate(String key)
DATE_FORMAT_KEY
property, or if it's not defined with the
DEFAULT_DATE_FORMAT
pattern.key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a Date.public Date getDate(String key, String format)
key
- The configuration key.format
- The non-localized DateFormat
pattern.ConversionException
- is thrown if the key maps to an
object that is not a Date.public Date getDate(String key, Date defaultValue)
DATE_FORMAT_KEY
property, or if it's not defined with the
DEFAULT_DATE_FORMAT
pattern. If the key doesn't map to an
existing object, the default value is returned.key
- The configuration key.defaultValue
- The default value.ConversionException
- is thrown if the key maps to an
object that is not a Date.public Date getDate(String key, Date defaultValue, String format)
key
- The configuration key.defaultValue
- The default value.format
- The non-localized DateFormat
pattern.ConversionException
- is thrown if the key maps to an
object that is not a Date.public List<Date> getDateList(String key, String format)
key
- The configuration key.format
- The non-localized DateFormat
pattern.ConversionException
- is thrown if the key maps to an
object that is not a list of Dates.public List<Date> getDateList(String key, List<Date> defaultValue)
DATE_FORMAT_KEY
property,
or if it's not defined with the DEFAULT_DATE_FORMAT
pattern.
If the key doesn't map to an existing object, the default value is
returned.key
- The configuration key.defaultValue
- The default value.ConversionException
- is thrown if the key maps to an
object that is not a list of Dates.public List<Date> getDateList(String key, List<Date> defaultValue, String format)
key
- The configuration key.defaultValue
- The default value.format
- The non-localized DateFormat
pattern.ConversionException
- is thrown if the key maps to an
object that is not a list of Dates.public Date[] getDateArray(String key)
DATE_FORMAT_KEY
property,
or if it's not defined with the DEFAULT_DATE_FORMAT
pattern.
If the key doesn't map to an existing object an empty array is returned.key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of Dates.public Date[] getDateArray(String key, String format)
key
- The configuration key.format
- The non-localized DateFormat
pattern.ConversionException
- is thrown if the key maps to an
object that is not a list of Dates.public Date[] getDateArray(String key, Date[] defaultValue)
DATE_FORMAT_KEY
property,
or if it's not defined with the DEFAULT_DATE_FORMAT
pattern.
If the key doesn't map to an existing object an empty array is returned.key
- The configuration key.defaultValue
- the default value, which will be returned if the property is not foundConversionException
- is thrown if the key maps to an
object that is not a list of Dates.public Date[] getDateArray(String key, Date[] defaultValue, String format)
key
- The configuration key.defaultValue
- The default value.format
- The non-localized DateFormat
pattern.ConversionException
- is thrown if the key maps to an
object that is not a list of Dates.public Calendar getCalendar(String key)
DATE_FORMAT_KEY
property, or if it's not defined
with the DEFAULT_DATE_FORMAT
pattern.key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a Calendar.public Calendar getCalendar(String key, String format)
key
- The configuration key.format
- The non-localized DateFormat
pattern.ConversionException
- is thrown if the key maps to an
object that is not a Calendar.public Calendar getCalendar(String key, Calendar defaultValue)
DATE_FORMAT_KEY
property, or if it's not defined
with the DEFAULT_DATE_FORMAT
pattern. If the key doesn't map
to an existing object, the default value is returned.key
- The configuration key.defaultValue
- The default value.ConversionException
- is thrown if the key maps to an
object that is not a Calendar.public Calendar getCalendar(String key, Calendar defaultValue, String format)
key
- The configuration key.defaultValue
- The default value.format
- The non-localized DateFormat
pattern.ConversionException
- is thrown if the key maps to an
object that is not a Calendar.public List<Calendar> getCalendarList(String key)
DATE_FORMAT_KEY
property,
or if it's not defined with the DEFAULT_DATE_FORMAT
pattern.
If the key doesn't map to an existing object an empty list is returned.key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of Calendars.public List<Calendar> getCalendarList(String key, String format)
key
- The configuration key.format
- The non-localized DateFormat
pattern.ConversionException
- is thrown if the key maps to an
object that is not a list of Calendars.public List<Calendar> getCalendarList(String key, List<Calendar> defaultValue)
DATE_FORMAT_KEY
property,
or if it's not defined with the DEFAULT_DATE_FORMAT
pattern.
If the key doesn't map to an existing object, the default value is
returned.key
- The configuration key.defaultValue
- The default value.ConversionException
- is thrown if the key maps to an
object that is not a list of Calendars.public List<Calendar> getCalendarList(String key, List<Calendar> defaultValue, String format)
key
- The configuration key.defaultValue
- The default value.format
- The non-localized DateFormat
pattern.ConversionException
- is thrown if the key maps to an
object that is not a list of Calendars.public Calendar[] getCalendarArray(String key)
DATE_FORMAT_KEY
property,
or if it's not defined with the DEFAULT_DATE_FORMAT
pattern.
If the key doesn't map to an existing object an empty array is returned.key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of Calendars.public Calendar[] getCalendarArray(String key, String format)
key
- The configuration key.format
- The non-localized DateFormat
pattern.ConversionException
- is thrown if the key maps to an
object that is not a list of Calendars.public Calendar[] getCalendarArray(String key, Calendar[] defaultValue)
DATE_FORMAT_KEY
property,
or if it's not defined with the DEFAULT_DATE_FORMAT
pattern.
If the key doesn't map to an existing object an empty array is returned.key
- The configuration key.defaultValue
- the default value, which will be returned if the property is not foundConversionException
- is thrown if the key maps to an
object that is not a list of Calendars.public Calendar[] getCalendarArray(String key, Calendar[] defaultValue, String format)
key
- The configuration key.defaultValue
- The default value.format
- The non-localized DateFormat
pattern.ConversionException
- is thrown if the key maps to an
object that is not a list of Calendars.public Locale getLocale(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a Locale.public Locale getLocale(String key, Locale defaultValue)
key
- The configuration key.defaultValue
- The default value.ConversionException
- is thrown if the key maps to an
object that is not a Locale.public List<Locale> getLocaleList(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of Locales.public List<Locale> getLocaleList(String key, List<Locale> defaultValue)
key
- The configuration key.defaultValue
- The default value.ConversionException
- is thrown if the key maps to an
object that is not a list of Locales.public Locale[] getLocaleArray(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of Locales.public Locale[] getLocaleArray(String key, Locale[] defaultValue)
key
- The configuration key.defaultValue
- the default value, which will be returned if the property is not foundConversionException
- is thrown if the key maps to an
object that is not a list of Locales.public Color getColor(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a Color.public Color getColor(String key, Color defaultValue)
key
- The configuration key.defaultValue
- The default value.ConversionException
- is thrown if the key maps to an
object that is not a Color.public List<Color> getColorList(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of Colors.public List<Color> getColorList(String key, List<Color> defaultValue)
key
- The configuration key.defaultValue
- The default value.ConversionException
- is thrown if the key maps to an
object that is not a list of Colors.public Color[] getColorArray(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of Colors.public Color[] getColorArray(String key, Color[] defaultValue)
key
- The configuration key.defaultValue
- the default value, which will be returned if the property is not foundConversionException
- is thrown if the key maps to an
object that is not a list of Colors.Copyright © 2001–2013 The Apache Software Foundation. All rights reserved.