public final class PropertyConverter extends Object
Modifier and Type | Method and Description |
---|---|
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 always trimming the elements.
|
static List |
split(String s,
char delimiter,
boolean trim)
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 Short |
toShort(Object value)
Convert the specified object into a Short.
|
static URL |
toURL(Object value)
Convert the specified object into an URL.
|
public static Boolean toBoolean(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 convertConversionException
- thrown if the value cannot be converted to a booleanpublic static Byte toByte(Object value) throws ConversionException
value
- the value to convertConversionException
- thrown if the value cannot be converted to a bytepublic static Short toShort(Object value) throws ConversionException
value
- the value to convertConversionException
- thrown if the value cannot be converted to a shortpublic static Integer toInteger(Object value) throws ConversionException
value
- the value to convertConversionException
- thrown if the value cannot be converted to an integerpublic static Long toLong(Object value) throws ConversionException
value
- the value to convertConversionException
- thrown if the value cannot be converted to a Longpublic static Float toFloat(Object value) throws ConversionException
value
- the value to convertConversionException
- thrown if the value cannot be converted to a Floatpublic static Double toDouble(Object value) throws ConversionException
value
- the value to convertConversionException
- thrown if the value cannot be converted to a Doublepublic static BigInteger toBigInteger(Object value) throws ConversionException
value
- the value to convertConversionException
- thrown if the value cannot be converted to a BigIntegerpublic static BigDecimal toBigDecimal(Object value) throws ConversionException
value
- the value to convertConversionException
- thrown if the value cannot be converted to a BigDecimalpublic static URL toURL(Object value) throws ConversionException
value
- the value to convertConversionException
- thrown if the value cannot be converted to an URLpublic static Locale toLocale(Object value) throws ConversionException
value
- the value to convertConversionException
- thrown if the value cannot be converted to a Localepublic static List split(String s, char delimiter, boolean trim)
s
- the string to splitdelimiter
- the delimitertrim
- a flag whether the single elements should be trimmedpublic static List split(String s, char delimiter)
split(s, delimiter, true)
.s
- the string to splitdelimiter
- the delimiterpublic static String escapeDelimiters(String s, char delimiter)
s
- the string with the valuedelimiter
- the list delimiter to usepublic static Color toColor(Object value) throws ConversionException
value
- the value to convertConversionException
- thrown if the value cannot be converted to a Colorpublic static Date toDate(Object value, String format) throws ConversionException
value
- the value to convertformat
- the DateFormat pattern to parse String valuesConversionException
- thrown if the value cannot be converted to a Calendarpublic static Calendar toCalendar(Object value, String format) throws ConversionException
value
- the value to convertformat
- the DateFormat pattern to parse String valuesConversionException
- thrown if the value cannot be converted to a Calendarpublic static Iterator toIterator(Object value, char delimiter)
value
- the value to "split"delimiter
- the delimiter for String valuespublic static Object interpolate(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 objectCopyright © 2018 JBoss by Red Hat. All rights reserved.