org.apache.commons.configuration
public final class PropertyConverter extends Object
Since: 1.1
Version: $Revision: 490321 $, $Date: 2006-12-26 17:19:07 +0100 (Di, 26 Dez 2006) $
Field Summary | |
---|---|
static Class[] | CONSTR_ARGS Constant for the argument classes of the Number constructor that takes
a String. |
static String | HEX_PREFIX Constant for the prefix of hex numbers. |
static int | HEX_RADIX Constant for the radix of hex numbers. |
static String | LIST_ESCAPE Constant for the list delimiter escaping character. |
Constructor Summary | |
---|---|
PropertyConverter()
Private constructor prevents instances from being created. |
Method Summary | |
---|---|
static String | escapeDelimiters(String s, char delimiter)
Escapes the delimiters that might be contained in the given string. |
static Object | interpolate(Object value, AbstractConfiguration config)
Performs interpolation of the specified value. |
static List | split(String s, char delimiter)
Split a string on the specified delimiter. |
static BigDecimal | toBigDecimal(Object value)
Convert the specified object into a BigDecimal.
|
static BigInteger | toBigInteger(Object value)
Convert the specified object into a BigInteger.
|
static Boolean | toBoolean(Object value)
Convert the specified object into a Boolean. |
static Byte | toByte(Object value)
Convert the specified object into a Byte.
|
static Calendar | toCalendar(Object value, String format)
Convert the specified object into a Calendar.
|
static Color | toColor(Object value)
Convert the specified object into a Color. |
static Date | toDate(Object value, String format)
Convert the specified object into a Date.
|
static Double | toDouble(Object value)
Convert the specified object into a Double.
|
static Float | toFloat(Object value)
Convert the specified object into a Float.
|
static Integer | toInteger(Object value)
Convert the specified object into an Integer.
|
static Iterator | toIterator(Object value, char delimiter)
Return an iterator over the simple values of a composite value. |
static Locale | toLocale(Object value)
Convert the specified object into a Locale.
|
static Long | toLong(Object value)
Convert the specified object into a Long.
|
static Number | toNumber(Object value, Class targetClass)
Tries to convert the specified object into a number object. |
static Short | toShort(Object value)
Convert the specified object into a Short.
|
static URL | toURL(Object value)
Convert the specified object into an URL.
|
Parameters: s the string with the value delimiter the list delimiter to use
Returns: the correctly esaped string
${...}
. If
this is the case, all occurrances will be substituted by their current
values.
Parameters: value the value to be interpolated config the current configuration object
Returns: the interpolated value
Parameters: s the string to split delimiter the delimiter
Returns: a list with the single tokens
Parameters: value the value to convert
Returns: the converted value
Throws: ConversionException thrown if the value cannot be converted to a BigDecimal
Parameters: value the value to convert
Returns: the converted value
Throws: ConversionException thrown if the value cannot be converted to a BigInteger
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.
Parameters: value the value to convert
Returns: the converted value
Throws: ConversionException thrown if the value cannot be converted to a boolean
Parameters: value the value to convert
Returns: the converted value
Throws: ConversionException thrown if the value cannot be converted to a byte
Parameters: value the value to convert format the DateFormat pattern to parse String values
Returns: the converted value
Throws: ConversionException thrown if the value cannot be converted to a Calendar
Parameters: value the value to convert
Returns: the converted value
Throws: ConversionException thrown if the value cannot be converted to a Color
Parameters: value the value to convert format the DateFormat pattern to parse String values
Returns: the converted value
Throws: ConversionException thrown if the value cannot be converted to a Calendar
Parameters: value the value to convert
Returns: the converted value
Throws: ConversionException thrown if the value cannot be converted to a Double
Parameters: value the value to convert
Returns: the converted value
Throws: ConversionException thrown if the value cannot be converted to a Float
Parameters: value the value to convert
Returns: the converted value
Throws: ConversionException thrown if the value cannot be converted to an integer
Parameters: value the value to "split" delimiter the delimiter for String values
Returns: an iterator for accessing the single values
Parameters: value the value to convert
Returns: the converted value
Throws: ConversionException thrown if the value cannot be converted to a Locale
Parameters: value the value to convert
Returns: the converted value
Throws: ConversionException thrown if the value cannot be converted to a Long
Parameters: value the value to be converted (must not be null) targetClass the target class of the conversion (must be derived
from java.lang.Number
)
Returns: the converted number
Throws: ConversionException if the object cannot be converted
Parameters: value the value to convert
Returns: the converted value
Throws: ConversionException thrown if the value cannot be converted to a short
Parameters: value the value to convert
Returns: the converted value
Throws: ConversionException thrown if the value cannot be converted to an URL