public interface BulkTypeConverters extends Ordered, TypeConverter
Converter
s and then bulked together into a single source code
generated class. This class is then used at runtime as an optimized and really fast way of using all those type
converters by the TypeConverterRegistry
.MISS_VALUE
Modifier and Type | Method and Description |
---|---|
default boolean |
allowNull()
Whether the type converter allows returning null as a valid response.
|
<T> T |
convertTo(Class<?> from,
Class<T> to,
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).
|
default <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).
|
default <T> T |
convertTo(Class<T> type,
Object value)
Converts the value to the specified type
|
default int |
getOrder()
Gets the order.
|
TypeConverter |
lookup(Class<?> toType,
Class<?> fromType)
Performs a lookup for a given type converter.
|
default <T> T |
mandatoryConvertTo(Class<?> from,
Class<T> to,
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).
|
default <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).
|
default <T> T |
mandatoryConvertTo(Class<T> type,
Object value)
Converts the value to the specified type
|
int |
size()
Number of type converters included
|
default <T> T |
tryConvertTo(Class<?> from,
Class<T> to,
Exchange exchange,
Object value)
Tries to convert the value to the specified type, returning null if not possible to convert.
|
default <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.
|
default <T> T |
tryConvertTo(Class<T> type,
Object value)
Tries to convert the value to the specified type, returning null if not possible to convert.
|
TypeConverter lookup(Class<?> toType, Class<?> fromType)
toType
- the type to convert tofromType
- the type to convert from<T> T convertTo(Class<?> from, Class<T> to, Exchange exchange, Object value) throws TypeConversionException
from
- the from typeto
- the to typeexchange
- the current exchangevalue
- the value to be convertedTypeConversionException
- is thrown if error during type conversiondefault <T> T tryConvertTo(Class<?> from, Class<T> to, Exchange exchange, Object value) throws TypeConversionException
from
- the from typeto
- the to typevalue
- the value to be convertedTypeConversionException
default <T> T mandatoryConvertTo(Class<?> from, Class<T> to, Exchange exchange, Object value) throws TypeConversionException, NoTypeConversionAvailableException
from
- the from typeto
- the to 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 typeint size()
default int getOrder()
Ordered
Integer.MAX_VALUE
or eg Ordered.LOWEST
.default boolean allowNull()
TypeConverter
allowNull
in interface TypeConverter
default <T> T convertTo(Class<T> type, Object value) throws TypeConversionException
TypeConverter
convertTo
in interface TypeConverter
type
- the requested typevalue
- the value to be convertedTypeConversionException
- is thrown if error during type conversiondefault <T> T convertTo(Class<T> type, Exchange exchange, Object value) throws TypeConversionException
TypeConverter
convertTo
in interface TypeConverter
type
- the requested typeexchange
- the current exchangevalue
- the value to be convertedTypeConversionException
- is thrown if error during type conversiondefault <T> T mandatoryConvertTo(Class<T> type, Object value) throws TypeConversionException, NoTypeConversionAvailableException
TypeConverter
mandatoryConvertTo
in interface TypeConverter
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 typedefault <T> T mandatoryConvertTo(Class<T> type, Exchange exchange, Object value) throws TypeConversionException, NoTypeConversionAvailableException
TypeConverter
mandatoryConvertTo
in interface TypeConverter
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 typedefault <T> T tryConvertTo(Class<T> type, Object value)
TypeConverter
tryConvertTo
in interface TypeConverter
type
- the requested typevalue
- the value to be converteddefault <T> T tryConvertTo(Class<T> type, Exchange exchange, Object value)
TypeConverter
tryConvertTo
in interface TypeConverter
type
- the requested typeexchange
- the current exchangevalue
- the value to be convertedApache Camel