THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
From Camel 2.16 onwards you type converter classes can implement org.apache.camel.TypeConverters
which is an marker interface. Then for each type converter you want use the @Converter
annotation.
Code Block |
---|
private class MyOrderTypeConverters implements TypeConverters {
@Converter
public MyOrder toMyOrder(String orderId) {
MyOrder order = new MyOrder();
order.setId(Integer.parseInt(orderId));
return order;
}
} |
Then you can add these converters to the registry using
Code Block |
---|
MyClassWithConvertersMyOrderTypeConverters myClass = ... context.getTypeConverterRegistry().addTypeConverters(myClass); |
If you are using Spring or Blueprint, then you can just declare a <bean> then CamelContext will automatic discover and add the converters.
Code Block |
---|
<bean id="myConvertersmyOrderTypeConverters" class="..."/> <camelContext ...> ... </camelContext> |
...