How to Create a Type Converter for Apache Camel

SampleConverter.java

package br.eti.fernandoribeiro.sample;

import org.apache.camel.Converter;

@Converter
public final class SampleConverter {

   @Converter
   public static Sample2 toSample2(final Sample1 value) { // May take the exchange as the second parameter
      return null;
   }

}

SampleFallbackConverter.java

package br.eti.fernandoribeiro.sample;

import org.apache.camel.FallbackConverter;

@FallbackConverter
public final class Sample1FallbackConverter {

   @FallbackConverter
   public static Sample2 toSample2(final Sample1 value) { // May take the exchange as the second parameter
      return null;
   }

}

TypeConverter

br.eti.fernandoribeiro.sample

http://camel.apache.org/maven/camel-2.2.0/camel-core/apidocs/org/apache/camel/Converter.html

http://camel.apache.org/maven/camel-2.2.0/camel-core/apidocs/org/apache/camel/FallbackConverter.html

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s