public abstract class TypeConverterSupport extends Object implements TypeConverter
TypeConverter implementations.
Implementators need only to implement the TypeConverter.convertTo(Class, org.apache.camel.Exchange, Object)
method, and can rely on the default implementations of the other methods from this support class.| Constructor and Description |
|---|
TypeConverterSupport() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
allowNull()
Whether the type converter allows returning null as a valid response.
|
<T> T |
convertTo(Class<T> type,
Object value)
Converts the value to the specified type
|
<T> T |
mandatoryConvertTo(Class<T> type,
Exchange exchange,
Object value)
Converts the value to the specified type in the context of an exchange
Used when conversion requires extra information from the current
exchange (such as encoding).
|
<T> T |
mandatoryConvertTo(Class<T> type,
Object value)
Converts the value to the specified type
|
<T> T |
tryConvertTo(Class<T> type,
Exchange exchange,
Object value)
Tries to convert the value to the specified type in the context of an exchange,
returning null if not possible to convert.
|
<T> T |
tryConvertTo(Class<T> type,
Object value)
Tries to convert the value to the specified type,
returning null if not possible to convert.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitconvertTopublic boolean allowNull()
TypeConverterallowNull in interface TypeConverterpublic <T> T convertTo(Class<T> type, Object value) throws TypeConversionException
TypeConverterconvertTo in interface TypeConvertertype - the requested typevalue - the value to be convertedTypeConversionException - is thrown if error during type conversionpublic <T> T mandatoryConvertTo(Class<T> type, Object value) throws TypeConversionException, NoTypeConversionAvailableException
TypeConvertermandatoryConvertTo in interface TypeConvertertype - the requested typevalue - the value to be convertedTypeConversionException - is thrown if error during type conversionNoTypeConversionAvailableException - if no type converters exists to convert to the given typepublic <T> T mandatoryConvertTo(Class<T> type, Exchange exchange, Object value) throws TypeConversionException, NoTypeConversionAvailableException
TypeConvertermandatoryConvertTo in interface TypeConvertertype - the requested typeexchange - the current exchangevalue - the value to be convertedTypeConversionException - is thrown if error during type conversionNoTypeConversionAvailableException - if no type converters exists to convert to the given typepublic <T> T tryConvertTo(Class<T> type, Object value)
TypeConvertertryConvertTo in interface TypeConvertertype - the requested typevalue - the value to be convertedpublic <T> T tryConvertTo(Class<T> type, Exchange exchange, Object value)
TypeConvertertryConvertTo in interface TypeConvertertype - the requested typeexchange - the current exchangevalue - the value to be convertedApache Camel