|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.configuration.PropertyConverter
public final class PropertyConverter
A utility class to convert the configuration properties into any type.
| Method Summary | |
|---|---|
static java.lang.String |
escapeDelimiters(java.lang.String s,
char delimiter)
Escapes the delimiters that might be contained in the given string. |
static java.lang.String |
escapeListDelimiter(java.lang.String s,
char delimiter)
Escapes the list delimiter if it is contained in the given string. |
static java.lang.Object |
interpolate(java.lang.Object value,
AbstractConfiguration config)
Performs interpolation of the specified value. |
static java.util.List |
split(java.lang.String s,
char delimiter)
Split a string on the specified delimiter always trimming the elements. |
static java.util.List |
split(java.lang.String s,
char delimiter,
boolean trim)
Split a string on the specified delimiter. |
static java.math.BigDecimal |
toBigDecimal(java.lang.Object value)
Convert the specified object into a BigDecimal. |
static java.math.BigInteger |
toBigInteger(java.lang.Object value)
Convert the specified object into a BigInteger. |
static java.lang.Boolean |
toBoolean(java.lang.Object value)
Convert the specified object into a Boolean. |
static java.lang.Byte |
toByte(java.lang.Object value)
Convert the specified object into a Byte. |
static java.util.Calendar |
toCalendar(java.lang.Object value,
java.lang.String format)
Convert the specified object into a Calendar. |
static java.awt.Color |
toColor(java.lang.Object value)
Convert the specified object into a Color. |
static java.util.Date |
toDate(java.lang.Object value,
java.lang.String format)
Convert the specified object into a Date. |
static java.lang.Double |
toDouble(java.lang.Object value)
Convert the specified object into a Double. |
static java.lang.Float |
toFloat(java.lang.Object value)
Convert the specified object into a Float. |
static java.lang.Integer |
toInteger(java.lang.Object value)
Convert the specified object into an Integer. |
static java.util.Iterator |
toIterator(java.lang.Object value,
char delimiter)
Return an iterator over the simple values of a composite value. |
static java.util.Locale |
toLocale(java.lang.Object value)
Convert the specified object into a Locale. |
static java.lang.Long |
toLong(java.lang.Object value)
Convert the specified object into a Long. |
static java.lang.Short |
toShort(java.lang.Object value)
Convert the specified object into a Short. |
static java.net.URL |
toURL(java.lang.Object value)
Convert the specified object into an URL. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static java.lang.Boolean toBoolean(java.lang.Object value)
throws ConversionException
org.apache.commons.lang.BooleanUtils class from the
Commons Lang
project is used to perform this conversion. This class accepts some more
tokens for the boolean value of true, e.g. yes and
on. Please refer to the documentation of this class for more
details.
value - the value to convert
ConversionException - thrown if the value cannot be converted to a boolean
public static java.lang.Byte toByte(java.lang.Object value)
throws ConversionException
value - the value to convert
ConversionException - thrown if the value cannot be converted to a byte
public static java.lang.Short toShort(java.lang.Object value)
throws ConversionException
value - the value to convert
ConversionException - thrown if the value cannot be converted to a short
public static java.lang.Integer toInteger(java.lang.Object value)
throws ConversionException
value - the value to convert
ConversionException - thrown if the value cannot be converted to an integer
public static java.lang.Long toLong(java.lang.Object value)
throws ConversionException
value - the value to convert
ConversionException - thrown if the value cannot be converted to a Long
public static java.lang.Float toFloat(java.lang.Object value)
throws ConversionException
value - the value to convert
ConversionException - thrown if the value cannot be converted to a Float
public static java.lang.Double toDouble(java.lang.Object value)
throws ConversionException
value - the value to convert
ConversionException - thrown if the value cannot be converted to a Double
public static java.math.BigInteger toBigInteger(java.lang.Object value)
throws ConversionException
value - the value to convert
ConversionException - thrown if the value cannot be converted to a BigInteger
public static java.math.BigDecimal toBigDecimal(java.lang.Object value)
throws ConversionException
value - the value to convert
ConversionException - thrown if the value cannot be converted to a BigDecimal
public static java.net.URL toURL(java.lang.Object value)
throws ConversionException
value - the value to convert
ConversionException - thrown if the value cannot be converted to an URL
public static java.util.Locale toLocale(java.lang.Object value)
throws ConversionException
value - the value to convert
ConversionException - thrown if the value cannot be converted to a Locale
public static java.util.List split(java.lang.String s,
char delimiter,
boolean trim)
s - the string to splitdelimiter - the delimitertrim - a flag whether the single elements should be trimmed
public static java.util.List split(java.lang.String s,
char delimiter)
split(s, delimiter, true).
s - the string to splitdelimiter - the delimiter
public static java.lang.String escapeDelimiters(java.lang.String s,
char delimiter)
escapeListDelimiter(String, char). In addition,
a single backslash will also be escaped.
s - the string with the valuedelimiter - the list delimiter to use
public static java.lang.String escapeListDelimiter(java.lang.String s,
char delimiter)
s - the string with the valuedelimiter - the list delimiter to use
public static java.awt.Color toColor(java.lang.Object value)
throws ConversionException
value - the value to convert
ConversionException - thrown if the value cannot be converted to a Color
public static java.util.Date toDate(java.lang.Object value,
java.lang.String format)
throws ConversionException
value - the value to convertformat - the DateFormat pattern to parse String values
ConversionException - thrown if the value cannot be converted to a Calendar
public static java.util.Calendar toCalendar(java.lang.Object value,
java.lang.String format)
throws ConversionException
value - the value to convertformat - the DateFormat pattern to parse String values
ConversionException - thrown if the value cannot be converted to a Calendar
public static java.util.Iterator toIterator(java.lang.Object value,
char delimiter)
value - the value to "split"delimiter - the delimiter for String values
public static java.lang.Object interpolate(java.lang.Object value,
AbstractConfiguration config)
${...}. If
this is the case, all occurrances will be substituted by their current
values.
value - the value to be interpolatedconfig - the current configuration object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||