public interface TypeConverter
Modifier and Type | Field and Description |
---|---|
static Object |
MISS_VALUE |
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,
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 |
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.
|
static final Object MISS_VALUE
boolean allowNull()
<T> T convertTo(Class<T> type, Object value) throws TypeConversionException
type
- the requested typevalue
- the value to be convertedTypeConversionException
- is thrown if error during type conversion<T> T convertTo(Class<T> type, Exchange exchange, Object value) throws TypeConversionException
type
- the requested typeexchange
- the current exchangevalue
- the value to be convertedTypeConversionException
- is thrown if error during type conversion<T> T mandatoryConvertTo(Class<T> type, Object value) throws TypeConversionException, NoTypeConversionAvailableException
type
- 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 type<T> T mandatoryConvertTo(Class<T> type, Exchange exchange, Object value) throws TypeConversionException, NoTypeConversionAvailableException
type
- 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 type<T> T tryConvertTo(Class<T> type, Object value)
type
- the requested typevalue
- the value to be converted<T> T tryConvertTo(Class<T> type, Exchange exchange, Object value)
type
- the requested typeexchange
- the current exchangevalue
- the value to be convertedApache Camel