Java Code Examples for org.apache.camel.spi.TypeConverterRegistry#addTypeConverter()

The following examples show how to use org.apache.camel.spi.TypeConverterRegistry#addTypeConverter() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomTypeConverterLoader.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@Override
public void load(TypeConverterRegistry registry) throws TypeConverterLoaderException {
    registry.addTypeConverter(
            MyPair.class,
            String.class,
            new SimpleTypeConverter(false, (type, exchange, value) -> MyPair.fromString((String) value)));
}
 
Example 2
Source File: CloudEventTypeConverterLoader.java    From camel-k-runtime with Apache License 2.0 4 votes vote down vote up
private static void addTypeConverter(TypeConverterRegistry registry, Class<?> toType, Class<?> fromType, boolean allowNull, SimpleTypeConverter.ConversionMethod method) { 
    registry.addTypeConverter(toType, fromType, new SimpleTypeConverter(allowNull, method));
}