Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

We have most of the common converters for common Java types in the org.apache.camel.converter package and its children.

Writing your own Type Converters

You are welcome to write your own converters. Remember to use the @Converter annotations on the classes and methods you wish to use. Then add the packages to a file called META-INF/services/org/apache/camel/TypeConverter in your jar.

Remember to make sure that

  • static methods are encouraged to reduce caching; but instance methods are fine, particularly if you want to allow optional dependency injection to customize the converter
  • converter methods should be thread safe and reentrant