Package org.apache.camel.converter
Class ObjectConverter
- java.lang.Object
-
- org.apache.camel.converter.ObjectConverter
-
@Converter(generateBulkLoader=true) public final class ObjectConverter extends Object
Some core java.lang based Type Converters
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
fromCharArray(char[] value)
static Iterable<?>
iterable(Object value)
Creates an iterable over the valuestatic Iterator<?>
iterator(Object value)
Creates an iterator over the valuestatic BigInteger
toBigInteger(Object value)
Returns the converted value, or null if the value is nullstatic boolean
toBool(Object value)
Converts the given value to a boolean, handling strings or Boolean objects; otherwise returning false if the value could not be converted to a booleanstatic Boolean
toBoolean(byte[] value, org.apache.camel.Exchange exchange)
static Boolean
toBoolean(Object value)
Converts the given value to a Boolean, handling strings or Boolean objects; otherwise returning null if the value cannot be converted to a booleanstatic Boolean
toBoolean(String value)
static Byte
toByte(byte[] value, org.apache.camel.Exchange exchange)
static Byte
toByte(Number value)
Returns the converted value, or null if the value is nullstatic Byte
toByte(String value)
static char
toChar(byte[] value)
static char
toChar(String value)
static Character
toCharacter(byte[] value)
static Character
toCharacter(String value)
static char[]
toCharArray(byte[] value, org.apache.camel.Exchange exchange)
static char[]
toCharArray(String value)
static Class<?>
toClass(String value, org.apache.camel.CamelContext camelContext)
Returns the converted value, or null if the value is nullstatic Double
toDouble(byte[] value, org.apache.camel.Exchange exchange)
static Double
toDouble(Number value)
Returns the converted value, or null if the value is nullstatic Double
toDouble(String value)
static Float
toFloat(byte[] value, org.apache.camel.Exchange exchange)
static Float
toFloat(Number value)
Returns the converted value, or null if the value is nullstatic Float
toFloat(String value)
static Integer
toInteger(byte[] value, org.apache.camel.Exchange exchange)
static Integer
toInteger(Number value)
Returns the converted value, or null if the value is nullstatic Integer
toInteger(String value)
static Long
toLong(byte[] value, org.apache.camel.Exchange exchange)
static Long
toLong(Number value)
Returns the converted value, or null if the value is nullstatic Long
toLong(String value)
static Number
toNumber(byte[] value, org.apache.camel.Exchange exchange)
static Number
toNumber(String text)
static Short
toShort(byte[] value, org.apache.camel.Exchange exchange)
static Short
toShort(Number value)
Returns the converted value, or null if the value is nullstatic Short
toShort(String value)
static String
toString(Boolean value)
static String
toString(Integer value)
static String
toString(Long value)
static String
toString(StringBuffer value)
static String
toString(StringBuilder value)
-
-
-
Method Detail
-
toBool
@Converter(order=1) public static boolean toBool(Object value)
Converts the given value to a boolean, handling strings or Boolean objects; otherwise returning false if the value could not be converted to a boolean
-
toBoolean
@Converter(order=2) public static Boolean toBoolean(Object value)
Converts the given value to a Boolean, handling strings or Boolean objects; otherwise returning null if the value cannot be converted to a boolean
-
iterator
@Converter(order=3) public static Iterator<?> iterator(Object value)
Creates an iterator over the value
-
iterable
@Converter(order=4) public static Iterable<?> iterable(Object value)
Creates an iterable over the value
-
toByte
@Converter(order=5, allowNull=true) public static Byte toByte(Number value)
Returns the converted value, or null if the value is null
-
toByte
@Converter(order=7) public static Byte toByte(byte[] value, org.apache.camel.Exchange exchange)
-
toCharArray
@Converter(order=8) public static char[] toCharArray(String value)
-
toCharArray
@Converter(order=9) public static char[] toCharArray(byte[] value, org.apache.camel.Exchange exchange)
-
toCharacter
@Converter(order=11) public static Character toCharacter(byte[] value)
-
toChar
@Converter(order=12) public static char toChar(String value)
-
toChar
@Converter(order=13) public static char toChar(byte[] value)
-
fromCharArray
@Converter(order=14) public static String fromCharArray(char[] value)
-
toClass
@Converter(order=15) public static Class<?> toClass(String value, org.apache.camel.CamelContext camelContext)
Returns the converted value, or null if the value is null
-
toShort
@Converter(order=16, allowNull=true) public static Short toShort(Number value)
Returns the converted value, or null if the value is null
-
toShort
@Converter(order=18) public static Short toShort(byte[] value, org.apache.camel.Exchange exchange)
-
toInteger
@Converter(order=19, allowNull=true) public static Integer toInteger(Number value)
Returns the converted value, or null if the value is null
-
toInteger
@Converter(order=21) public static Integer toInteger(byte[] value, org.apache.camel.Exchange exchange)
-
toLong
@Converter(order=22, allowNull=true) public static Long toLong(Number value)
Returns the converted value, or null if the value is null
-
toLong
@Converter(order=24) public static Long toLong(byte[] value, org.apache.camel.Exchange exchange)
-
toBigInteger
@Converter(order=25, allowNull=true) public static BigInteger toBigInteger(Object value)
Returns the converted value, or null if the value is null
-
toFloat
@Converter(order=26) public static Float toFloat(Number value)
Returns the converted value, or null if the value is null
-
toFloat
@Converter(order=28) public static Float toFloat(byte[] value, org.apache.camel.Exchange exchange)
-
toDouble
@Converter(order=29) public static Double toDouble(Number value)
Returns the converted value, or null if the value is null
-
toDouble
@Converter(order=31) public static Double toDouble(byte[] value, org.apache.camel.Exchange exchange)
-
toString
@Converter(order=35) public static String toString(StringBuffer value)
-
toString
@Converter(order=36) public static String toString(StringBuilder value)
-
toBoolean
@Converter(order=38) public static Boolean toBoolean(byte[] value, org.apache.camel.Exchange exchange)
-
toNumber
@Converter(order=40) public static Number toNumber(byte[] value, org.apache.camel.Exchange exchange)
-
-