public class DataConfiguration extends AbstractConfiguration
URL
Locale
Date
Calendar
Color
InetAddress
javax.mail.internet.InternetAddress
(requires Javamail in the classpath)Enum
(Java 5 enumeration types)AbstractConfiguration
. Basically, the generic
get()
, and getCollection()
methods are
used to actually perform data conversions.
Example
Configuration fileconfig.properties
:
title.color = #0000FF remote.host = 192.168.0.53 default.locales = fr,en,de email.contact = ebourg@apache.org, tester@test.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");
Dates
Date objects are expected to be formatted with the patternyyyy-MM-dd HH:mm:ss
.
This default format can be changed by specifying another format in the
getters, or by putting a date format in the configuration under the key
org.apache.commons.configuration.format.date
. Alternatively, the
date format can also be specified via the ConversionHandler
used
by a configuration instance:
DefaultConversionHandler handler = new DefaultConversionHandler(); handler.setDateFormat("mm/dd/yyyy"); config.setConversionHandler(handler);
Modifier and Type | Field and Description |
---|---|
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.
|
Constructor and Description |
---|
DataConfiguration(Configuration configuration)
Creates a new instance of
DataConfiguration and sets the
wrapped configuration. |
Modifier and Type | Method and Description |
---|---|
protected void |
addPropertyDirect(String key,
Object value)
Adds a key/value pair to the Configuration.
|
protected void |
addPropertyInternal(String key,
Object obj)
Actually adds a property to this configuration.
|
protected void |
clearPropertyDirect(String key)
Removes the specified property from this configuration.
|
protected boolean |
containsKeyInternal(String key)
Actually checks whether the specified key is contained in this
configuration.
|
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.
|
ConversionHandler |
getConversionHandler()
Returns the
ConversionHandler used by this instance. |
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.
|
protected Iterator<String> |
getKeysInternal()
Actually creates an iterator for iterating over the keys in this
configuration.
|
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.
|
protected Object |
getPropertyInternal(String key)
Actually obtains the value of the specified property.
|
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.
|
URI |
getURI(String key)
Get an URI associated with the given configuration key.
|
URI |
getURI(String key,
URI defaultValue)
Get an URI associated with the given configuration key.
|
URI[] |
getURIArray(String key)
Get an array of URIs associated with the given configuration key.
|
URI[] |
getURIArray(String key,
URI... defaultValue)
Get an array of URIs associated with the given configuration key.
|
List<URI> |
getURIList(String key)
Get a list of URIs associated with the given configuration key.
|
List<URI> |
getURIList(String key,
List<URI> defaultValue)
Get a list of URIs 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.
|
protected boolean |
isEmptyInternal()
Actually checks whether this configuration contains data.
|
protected void |
setPropertyInternal(String key,
Object value)
Actually sets the value of a property.
|
addErrorLogListener, addProperty, append, beginRead, beginWrite, clear, clearInternal, clearProperty, cloneInterpolator, containsKey, copy, endRead, endWrite, get, get, getArray, getArray, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getCollection, getCollection, getConfigurationDecoder, getDouble, getDouble, getDouble, getEncodedString, getEncodedString, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getInterpolator, getKeys, getKeys, getKeysInternal, getList, getList, getList, getList, getListDelimiterHandler, getLogger, getLong, getLong, getLong, getProperties, getProperties, getProperty, getShort, getShort, getShort, getString, getString, getStringArray, getSynchronizer, immutableSubset, initLogger, installInterpolator, interpolate, interpolate, interpolatedConfiguration, isEmpty, isScalarValue, isThrowExceptionOnMissing, lock, setConfigurationDecoder, setConversionHandler, setDefaultLookups, setInterpolator, setListDelimiterHandler, setLogger, setParentInterpolator, setPrefixLookups, setProperty, setSynchronizer, setThrowExceptionOnMissing, size, sizeInternal, subset, unlock
addEventListener, clearErrorListeners, clearEventListeners, clone, copyEventListeners, createErrorEvent, createEvent, fireError, fireEvent, getEventListenerRegistrations, getEventListeners, isDetailEvents, removeEventListener, setDetailEvents
public static final String DATE_FORMAT_KEY
public static final String DEFAULT_DATE_FORMAT
public DataConfiguration(Configuration configuration)
DataConfiguration
and sets the
wrapped configuration.configuration
- the wrapped configurationpublic Configuration getConfiguration()
public ConversionHandler getConversionHandler()
ConversionHandler
used by this instance. This implementation returns the special conversion handler
used by this configuration instance.getConversionHandler
in class AbstractConfiguration
ConversionHandler
protected Object getPropertyInternal(String key)
AbstractConfiguration
getProperty()
. Concrete subclasses must define it to
fetch the value of the desired property.getPropertyInternal
in class AbstractConfiguration
key
- the key of the property in questionprotected void addPropertyInternal(String key, Object obj)
AbstractConfiguration
addProperty()
. It performs list splitting if necessary and
delegates to AbstractConfiguration.addPropertyDirect(String, Object)
for every single
property value.addPropertyInternal
in class AbstractConfiguration
key
- the key of the property to be addedobj
- the new property valueprotected void addPropertyDirect(String key, Object value)
AbstractConfiguration
addPropertyDirect
in class AbstractConfiguration
key
- key to use for mappingvalue
- object to storeprotected boolean isEmptyInternal()
AbstractConfiguration
isEmpty()
. It has to be defined by concrete subclasses.isEmptyInternal
in class AbstractConfiguration
protected boolean containsKeyInternal(String key)
AbstractConfiguration
containsKey()
. It has to
be defined by concrete subclasses.containsKeyInternal
in class AbstractConfiguration
key
- the key in questionprotected void clearPropertyDirect(String key)
AbstractConfiguration
clearProperty()
after it has done some
preparations. It must be overridden in sub classes.clearPropertyDirect
in class AbstractConfiguration
key
- the key to be removedprotected void setPropertyInternal(String key, Object value)
AbstractConfiguration
setProperty()
. It provides a default implementation of this
functionality by clearing the specified key and delegating to
addProperty()
. Subclasses should override this method if they can
provide a more efficient algorithm for setting a property value.setPropertyInternal
in class AbstractConfiguration
key
- the property keyvalue
- the new property valueprotected Iterator<String> getKeysInternal()
AbstractConfiguration
getKeys()
, it has to be
defined by concrete subclasses.getKeysInternal
in class AbstractConfiguration
Iterator
with all property keys in this configurationpublic 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 URI getURI(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not an URI.public URI getURI(String key, URI defaultValue)
key
- The configuration key.defaultValue
- The default value.ConversionException
- is thrown if the key maps to an
object that is not an URI.public URI[] getURIArray(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of URIs.public URI[] getURIArray(String key, URI... 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 URIs.public List<URI> getURIList(String key)
key
- The configuration key.ConversionException
- is thrown if the key maps to an
object that is not a list of URIs.public List<URI> getURIList(String key, List<URI> 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 URIs.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–2020 The Apache Software Foundation. All rights reserved.