You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/10/31 09:25:50 UTC

[camel] 01/05: CAMEL-15783: camel-core - Add order to @Converter so we can generate in hardcoded order

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit f9b80bd56e5592a244ddd1481730bab3084203c0
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Oct 31 09:47:17 2020 +0100

    CAMEL-15783: camel-core - Add order to @Converter so we can generate in hardcoded order
---
 .../src/main/java/org/apache/camel/Converter.java  |   6 +
 .../converter/CamelBaseBulkConverterLoader.java    |   2 +-
 .../org/apache/camel/converter/CamelConverter.java |  16 +--
 .../camel/converter/CollectionConverter.java       |  27 ++--
 .../apache/camel/converter/DateTimeConverter.java  |   6 +-
 .../apache/camel/converter/DurationConverter.java  |   8 +-
 .../org/apache/camel/converter/IOConverter.java    |  72 +++++------
 .../org/apache/camel/converter/NIOConverter.java   |  24 ++--
 .../apache/camel/converter/ObjectConverter.java    |  58 ++++-----
 .../org/apache/camel/converter/SQLConverter.java   |   4 +-
 .../apache/camel/converter/UriTypeConverter.java   |   6 +-
 .../camel/impl/converter/UriTypeConverterTest.java |   2 +-
 .../converter/stream/StreamCacheConverter.java     |  12 +-
 .../apache/camel/converter/jaxp/DomConverter.java  |  14 +--
 .../apache/camel/converter/jaxp/StaxConverter.java |  36 +++---
 .../apache/camel/converter/jaxp/XmlConverter.java  | 136 ++++++++++-----------
 .../camel/util/xml/StreamSourceConverter.java      |   8 +-
 17 files changed, 222 insertions(+), 215 deletions(-)

diff --git a/core/camel-api/src/main/java/org/apache/camel/Converter.java b/core/camel-api/src/main/java/org/apache/camel/Converter.java
index 6a45624..fef34e4 100644
--- a/core/camel-api/src/main/java/org/apache/camel/Converter.java
+++ b/core/camel-api/src/main/java/org/apache/camel/Converter.java
@@ -80,4 +80,10 @@ public @interface Converter {
      */
     boolean generateBulkLoader() default false;
 
+    /**
+     * To be used for ordering converter methods when source code generating bulk loaders.
+     * The order is lowest to highest, eg 1, 2, 3.
+     */
+    int order() default 0;
+
 }
diff --git a/core/camel-base/src/generated/java/org/apache/camel/converter/CamelBaseBulkConverterLoader.java b/core/camel-base/src/generated/java/org/apache/camel/converter/CamelBaseBulkConverterLoader.java
index 15a7ce6..1758c61 100644
--- a/core/camel-base/src/generated/java/org/apache/camel/converter/CamelBaseBulkConverterLoader.java
+++ b/core/camel-base/src/generated/java/org/apache/camel/converter/CamelBaseBulkConverterLoader.java
@@ -179,7 +179,7 @@ public final class CamelBaseBulkConverterLoader implements TypeConverterLoader,
             }
         } else if (to == java.lang.CharSequence.class) {
             if (value instanceof java.net.URI) {
-                return org.apache.camel.converter.UriTypeConverter.toCharSequence((java.net.URI) value);
+                return org.apache.camel.converter.UriTypeConverter.toString((java.net.URI) value);
             }
         } else if (to == java.lang.Character.class || to == char.class) {
             if (value instanceof java.lang.String) {
diff --git a/core/camel-base/src/main/java/org/apache/camel/converter/CamelConverter.java b/core/camel-base/src/main/java/org/apache/camel/converter/CamelConverter.java
index 80ffdcc..043aa83 100644
--- a/core/camel-base/src/main/java/org/apache/camel/converter/CamelConverter.java
+++ b/core/camel-base/src/main/java/org/apache/camel/converter/CamelConverter.java
@@ -35,22 +35,22 @@ public final class CamelConverter {
     private CamelConverter() {
     }
 
-    @Converter
-    public static Processor toProcessor(final Predicate predicate) {
+    @Converter(order = 1)
+    public static Processor toProcessor(final Expression expression) {
         return exchange -> {
-            // the response from a predicate should be set on OUT
-            boolean answer = predicate.matches(exchange);
+            // the response from a expression should be set on OUT
+            Object answer = expression.evaluate(exchange, Object.class);
             Message out = exchange.getOut();
             out.copyFrom(exchange.getIn());
             out.setBody(answer);
         };
     }
 
-    @Converter
-    public static Processor toProcessor(final Expression expression) {
+    @Converter(order = 2)
+    public static Processor toProcessor(final Predicate predicate) {
         return exchange -> {
-            // the response from a expression should be set on OUT
-            Object answer = expression.evaluate(exchange, Object.class);
+            // the response from a predicate should be set on OUT
+            boolean answer = predicate.matches(exchange);
             Message out = exchange.getOut();
             out.copyFrom(exchange.getIn());
             out.setBody(answer);
diff --git a/core/camel-base/src/main/java/org/apache/camel/converter/CollectionConverter.java b/core/camel-base/src/main/java/org/apache/camel/converter/CollectionConverter.java
index fc3c331..d702bac 100644
--- a/core/camel-base/src/main/java/org/apache/camel/converter/CollectionConverter.java
+++ b/core/camel-base/src/main/java/org/apache/camel/converter/CollectionConverter.java
@@ -46,7 +46,7 @@ public final class CollectionConverter {
     /**
      * Converts a collection to an array
      */
-    @Converter
+    @Converter(order = 1)
     public static Object[] toArray(Collection<?> value) {
         return value.toArray();
     }
@@ -54,7 +54,7 @@ public final class CollectionConverter {
     /**
      * Converts an array to a collection
      */
-    @Converter
+    @Converter(order = 2)
     public static List<Object> toList(Object[] array) {
         return Arrays.asList(array);
     }
@@ -62,7 +62,7 @@ public final class CollectionConverter {
     /**
      * Converts a collection to a List if it is not already
      */
-    @Converter
+    @Converter(order = 3)
     public static <T> List<T> toList(Collection<T> collection) {
         return new ArrayList<>(collection);
     }
@@ -70,7 +70,7 @@ public final class CollectionConverter {
     /**
      * Converts an {@link Iterator} to a {@link ArrayList}
      */
-    @Converter
+    @Converter(order = 4)
     public static <T> ArrayList<T> toArrayList(Iterator<T> it) {
         if (it instanceof ArrayList) {
             return (ArrayList<T>) it;
@@ -85,7 +85,7 @@ public final class CollectionConverter {
     /**
      * Converts an {@link Iterable} to a {@link ArrayList}
      */
-    @Converter
+    @Converter(order = 5)
     public static <T> ArrayList<T> toArrayList(Iterable<T> it) {
         if (it instanceof ArrayList) {
             return (ArrayList<T>) it;
@@ -97,36 +97,36 @@ public final class CollectionConverter {
         return list;
     }
 
-    @Converter
+    @Converter(order = 6)
     public static Set<Object> toSet(Object[] array) {
         Set<Object> answer = new HashSet<>();
         answer.addAll(Arrays.asList(array));
         return answer;
     }
 
-    @Converter
+    @Converter(order = 7)
     public static <T> Set<T> toSet(Collection<T> collection) {
         return new HashSet<>(collection);
     }
 
-    @Converter
+    @Converter(order = 8)
     public static <K, V> Set<Map.Entry<K, V>> toSet(Map<K, V> map) {
         return map.entrySet();
     }
 
-    @Converter
+    @Converter(order = 9)
     public static Properties toProperties(Map<Object, Object> map) {
         Properties answer = new Properties();
         answer.putAll(map);
         return answer;
     }
 
-    @Converter
+    @Converter(order = 10)
     public static <K, V> Hashtable<K, V> toHashtable(Map<? extends K, ? extends V> map) {
         return new Hashtable<>(map);
     }
 
-    @Converter
+    @Converter(order = 11)
     public static <K, V> HashMap<K, V> toHashMap(Map<? extends K, ? extends V> map) {
         return new HashMap<>(map);
     }
@@ -134,7 +134,7 @@ public final class CollectionConverter {
     /**
      * Converts an {@link Iterable} into a {@link List}
      */
-    @Converter
+    @Converter(order = 12)
     public static <T> List<T> toList(Iterable<T> iterable) {
         if (iterable instanceof List) {
             return (List<T>) iterable;
@@ -149,7 +149,7 @@ public final class CollectionConverter {
     /**
      * Converts an {@link Iterator} into a {@link List}
      */
-    @Converter
+    @Converter(order = 13)
     public static <T> List<T> toList(Iterator<T> it) {
         if (it instanceof List) {
             return (List<T>) it;
@@ -160,4 +160,5 @@ public final class CollectionConverter {
         }
         return result;
     }
+
 }
diff --git a/core/camel-base/src/main/java/org/apache/camel/converter/DateTimeConverter.java b/core/camel-base/src/main/java/org/apache/camel/converter/DateTimeConverter.java
index fa76e10..230a44e 100644
--- a/core/camel-base/src/main/java/org/apache/camel/converter/DateTimeConverter.java
+++ b/core/camel-base/src/main/java/org/apache/camel/converter/DateTimeConverter.java
@@ -33,17 +33,17 @@ public final class DateTimeConverter {
     private DateTimeConverter() {
     }
 
-    @Converter
+    @Converter(order = 1)
     public static TimeZone toTimeZone(String s) {
         return TimeZone.getTimeZone(s);
     }
 
-    @Converter
+    @Converter(order = 2)
     public static Date toDate(Long l) {
         return new Date(l);
     }
 
-    @Converter
+    @Converter(order = 3)
     public static Long toLong(Date date) {
         return date.getTime();
     }
diff --git a/core/camel-base/src/main/java/org/apache/camel/converter/DurationConverter.java b/core/camel-base/src/main/java/org/apache/camel/converter/DurationConverter.java
index 0efeff3..68e3600 100644
--- a/core/camel-base/src/main/java/org/apache/camel/converter/DurationConverter.java
+++ b/core/camel-base/src/main/java/org/apache/camel/converter/DurationConverter.java
@@ -33,17 +33,17 @@ public final class DurationConverter {
     private DurationConverter() {
     }
 
-    @Converter
+    @Converter(order = 1)
     public static Long toMilliSeconds(Duration source) {
         return source.toMillis();
     }
 
-    @Converter
+    @Converter(order = 2)
     public static Duration toDuration(Long source) {
         return Duration.ofMillis(source);
     }
 
-    @Converter
+    @Converter(order = 3)
     public static Duration toDuration(String source) {
         if (source.startsWith("P") || source.startsWith("-P") || source.startsWith("p") || source.startsWith("-p")) {
             return Duration.parse(source);
@@ -52,7 +52,7 @@ public final class DurationConverter {
         }
     }
 
-    @Converter
+    @Converter(order = 4)
     public static String toString(Duration source) {
         return source.toString();
     }
diff --git a/core/camel-base/src/main/java/org/apache/camel/converter/IOConverter.java b/core/camel-base/src/main/java/org/apache/camel/converter/IOConverter.java
index 63f56cb..6833dc7 100644
--- a/core/camel-base/src/main/java/org/apache/camel/converter/IOConverter.java
+++ b/core/camel-base/src/main/java/org/apache/camel/converter/IOConverter.java
@@ -65,96 +65,96 @@ public final class IOConverter {
     private IOConverter() {
     }
 
-    @Converter
+    @Converter(order = 1)
     public static InputStream toInputStream(Stream stream, Exchange exchange) {
         Iterator it = stream.iterator();
         return new InputStreamIterator(exchange.getContext().getTypeConverter(), it);
     }
 
-    @Converter
+    @Converter(order = 2)
     public static InputStream toInputStream(URL url) throws IOException {
         return IOHelper.buffered(url.openStream());
     }
 
-    @Converter
+    @Converter(order = 3)
     public static InputStream toInputStream(File file) throws IOException {
         return IOHelper.buffered(new FileInputStream(file));
     }
 
-    @Converter
+    @Converter(order = 4)
     public static BufferedReader toReader(File file, Exchange exchange) throws IOException {
         return IOHelper.toReader(file, ExchangeHelper.getCharsetName(exchange));
     }
 
-    @Converter
+    @Converter(order = 5)
     public static File toFile(String name) {
         return new File(name);
     }
 
-    @Converter
+    @Converter(order = 6)
     public static OutputStream toOutputStream(File file) throws FileNotFoundException {
         return IOHelper.buffered(new FileOutputStream(file));
     }
 
-    @Converter
+    @Converter(order = 7)
     public static BufferedWriter toWriter(File file, Exchange exchange) throws IOException {
         FileOutputStream os = new FileOutputStream(file, false);
         return IOHelper.toWriter(os, ExchangeHelper.getCharsetName(exchange));
     }
 
-    @Converter
+    @Converter(order = 8)
     public static Reader toReader(InputStream in, Exchange exchange) throws IOException {
         return IOHelper.buffered(new InputStreamReader(in, ExchangeHelper.getCharsetName(exchange)));
     }
 
-    @Converter
+    @Converter(order = 9)
     public static Reader toReader(byte[] data, Exchange exchange) throws IOException {
         return toReader(new ByteArrayInputStream(data), exchange);
     }
 
-    @Converter
+    @Converter(order = 10)
     public static Writer toWriter(OutputStream out, Exchange exchange) throws IOException {
         return IOHelper.buffered(new OutputStreamWriter(out, ExchangeHelper.getCharsetName(exchange)));
     }
 
-    @Converter
+    @Converter(order = 11)
     public static Reader toReader(String text) {
         // no buffering required as the complete string input is already passed
         // over as a whole
         return new StringReader(text);
     }
 
-    @Converter
+    @Converter(order = 12)
     public static InputStream toInputStream(String text, Exchange exchange) throws IOException {
         return toInputStream(text.getBytes(ExchangeHelper.getCharsetName(exchange)));
     }
 
-    @Converter
+    @Converter(order = 13)
     public static InputStream toInputStream(StringBuffer buffer, Exchange exchange) throws IOException {
         return toInputStream(buffer.toString(), exchange);
     }
 
-    @Converter
+    @Converter(order = 14)
     public static InputStream toInputStream(StringBuilder builder, Exchange exchange) throws IOException {
         return toInputStream(builder.toString(), exchange);
     }
 
-    @Converter
+    @Converter(order = 15)
     public static InputStream toInputStream(BufferedReader buffer, Exchange exchange) throws IOException {
         return toInputStream(toString(buffer), exchange);
     }
 
-    @Converter
+    @Converter(order = 16)
     public static String toString(byte[] data, Exchange exchange) throws IOException {
         return new String(data, ExchangeHelper.getCharsetName(exchange));
     }
 
-    @Converter
+    @Converter(order = 17)
     public static String toString(File file, Exchange exchange) throws IOException {
         return toString(toReader(file, exchange));
     }
 
-    @Converter
+    @Converter(order = 18)
     public static byte[] toByteArray(File file) throws IOException {
         InputStream is = toInputStream(file);
         try {
@@ -164,12 +164,12 @@ public final class IOConverter {
         }
     }
 
-    @Converter
+    @Converter(order = 19)
     public static byte[] toByteArray(Reader reader, Exchange exchange) throws IOException {
         return toByteArray(IOHelper.buffered(reader), exchange);
     }
 
-    @Converter
+    @Converter(order = 20)
     public static String toString(URL url, Exchange exchange) throws IOException {
         InputStream is = toInputStream(url);
         try {
@@ -179,40 +179,40 @@ public final class IOConverter {
         }
     }
 
-    @Converter
+    @Converter(order = 21)
     public static String toString(Reader reader) throws IOException {
         return IOHelper.toString(reader);
     }
 
-    @Converter
+    @Converter(order = 22)
     public static String toString(BufferedReader reader) throws IOException {
         return IOHelper.toString(reader);
     }
 
-    @Converter
+    @Converter(order = 23)
     public static byte[] toByteArray(BufferedReader reader, Exchange exchange) throws IOException {
         String s = toString(reader);
         return toByteArray(s, exchange);
     }
 
-    @Converter
+    @Converter(order = 24)
     public static byte[] toByteArray(String value, Exchange exchange) throws IOException {
         return value.getBytes(ExchangeHelper.getCharsetName(exchange));
     }
 
-    @Converter
+    @Converter(order = 25)
     public static String toString(InputStream in, Exchange exchange) throws IOException {
         return toString(toReader(in, exchange));
     }
 
-    @Converter
+    @Converter(order = 26)
     public static InputStream toInputStream(byte[] data) {
         // no buffering required as the complete byte input is already passed
         // over as a whole
         return new ByteArrayInputStream(data);
     }
 
-    @Converter
+    @Converter(order = 27)
     public static ObjectOutput toObjectOutput(OutputStream stream) throws IOException {
         if (stream instanceof ObjectOutput) {
             return (ObjectOutput) stream;
@@ -221,7 +221,7 @@ public final class IOConverter {
         }
     }
 
-    @Converter
+    @Converter(order = 28)
     public static ObjectInput toObjectInput(final InputStream stream, final Exchange exchange) throws IOException {
         if (stream instanceof ObjectInput) {
             return (ObjectInput) stream;
@@ -248,7 +248,7 @@ public final class IOConverter {
         }
     }
 
-    @Converter
+    @Converter(order = 29)
     public static byte[] toBytes(InputStream stream) throws IOException {
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         IOHelper.copy(IOHelper.buffered(stream), bos);
@@ -258,36 +258,36 @@ public final class IOConverter {
         return bos.toByteArray();
     }
 
-    @Converter
+    @Converter(order = 30)
     public static byte[] toByteArray(ByteArrayOutputStream os) {
         return os.toByteArray();
     }
 
-    @Converter
+    @Converter(order = 31)
     public static ByteBuffer covertToByteBuffer(InputStream is) throws IOException {
         ByteArrayOutputStream os = new ByteArrayOutputStream();
         IOHelper.copyAndCloseInput(is, os);
         return ByteBuffer.wrap(os.toByteArray());
     }
 
-    @Converter
+    @Converter(order = 32)
     public static String toString(ByteArrayOutputStream os, Exchange exchange) throws IOException {
         return os.toString(ExchangeHelper.getCharsetName(exchange));
     }
 
-    @Converter
+    @Converter(order = 33)
     public static InputStream toInputStream(ByteArrayOutputStream os) {
         // no buffering required as the complete byte array input is already
         // passed over as a whole
         return new ByteArrayInputStream(os.toByteArray());
     }
 
-    @Converter
+    @Converter(order = 34)
     public static Properties toProperties(File file) throws IOException {
         return toProperties(new FileInputStream(file));
     }
 
-    @Converter
+    @Converter(order = 35)
     public static Properties toProperties(InputStream is) throws IOException {
         Properties prop = new Properties();
         try {
@@ -298,7 +298,7 @@ public final class IOConverter {
         return prop;
     }
 
-    @Converter
+    @Converter(order = 36)
     public static Properties toProperties(Reader reader) throws IOException {
         Properties prop = new Properties();
         try {
diff --git a/core/camel-base/src/main/java/org/apache/camel/converter/NIOConverter.java b/core/camel-base/src/main/java/org/apache/camel/converter/NIOConverter.java
index 9e72460..d961cd1 100644
--- a/core/camel-base/src/main/java/org/apache/camel/converter/NIOConverter.java
+++ b/core/camel-base/src/main/java/org/apache/camel/converter/NIOConverter.java
@@ -46,29 +46,29 @@ public final class NIOConverter {
     private NIOConverter() {
     }
 
-    @Converter
+    @Converter(order = 1)
     public static byte[] toByteArray(ByteBuffer buffer) {
         byte[] bArray = new byte[buffer.limit()];
         buffer.get(bArray);
         return bArray;
     }
 
-    @Converter
+    @Converter(order = 2)
     public static String toString(ByteBuffer buffer, Exchange exchange) throws IOException {
         return IOConverter.toString(toByteArray(buffer), exchange);
     }
 
-    @Converter
+    @Converter(order = 3)
     public static ByteBuffer toByteBuffer(byte[] data) {
         return ByteBuffer.wrap(data);
     }
 
-    @Converter
+    @Converter(order = 4)
     public static ByteBuffer toByteBuffer(ByteArrayOutputStream baos) {
         return ByteBuffer.wrap(baos.toByteArray());
     }
 
-    @Converter
+    @Converter(order = 5)
     public static ByteBuffer toByteBuffer(File file) throws IOException {
         InputStream in = null;
         try {
@@ -87,7 +87,7 @@ public final class NIOConverter {
         }
     }
 
-    @Converter
+    @Converter(order = 6)
     public static ByteBuffer toByteBuffer(String value, Exchange exchange) {
         byte[] bytes = null;
         if (exchange != null) {
@@ -106,7 +106,7 @@ public final class NIOConverter {
         return ByteBuffer.wrap(bytes);
     }
 
-    @Converter
+    @Converter(order = 7)
     public static ByteBuffer toByteBuffer(Short value) {
         ByteBuffer buf = ByteBuffer.allocate(2);
         buf.putShort(value);
@@ -114,7 +114,7 @@ public final class NIOConverter {
         return buf;
     }
 
-    @Converter
+    @Converter(order = 8)
     public static ByteBuffer toByteBuffer(Integer value) {
         ByteBuffer buf = ByteBuffer.allocate(4);
         buf.putInt(value);
@@ -122,7 +122,7 @@ public final class NIOConverter {
         return buf;
     }
 
-    @Converter
+    @Converter(order = 9)
     public static ByteBuffer toByteBuffer(Long value) {
         ByteBuffer buf = ByteBuffer.allocate(8);
         buf.putLong(value);
@@ -130,7 +130,7 @@ public final class NIOConverter {
         return buf;
     }
 
-    @Converter
+    @Converter(order = 10)
     public static ByteBuffer toByteBuffer(Float value) {
         ByteBuffer buf = ByteBuffer.allocate(4);
         buf.putFloat(value);
@@ -138,7 +138,7 @@ public final class NIOConverter {
         return buf;
     }
 
-    @Converter
+    @Converter(order = 11)
     public static ByteBuffer toByteBuffer(Double value) {
         ByteBuffer buf = ByteBuffer.allocate(8);
         buf.putDouble(value);
@@ -146,7 +146,7 @@ public final class NIOConverter {
         return buf;
     }
 
-    @Converter
+    @Converter(order = 12)
     public static InputStream toInputStream(ByteBuffer bufferbuffer) {
         return IOConverter.toInputStream(toByteArray(bufferbuffer));
     }
diff --git a/core/camel-base/src/main/java/org/apache/camel/converter/ObjectConverter.java b/core/camel-base/src/main/java/org/apache/camel/converter/ObjectConverter.java
index 557985a..5cbb113 100644
--- a/core/camel-base/src/main/java/org/apache/camel/converter/ObjectConverter.java
+++ b/core/camel-base/src/main/java/org/apache/camel/converter/ObjectConverter.java
@@ -39,7 +39,7 @@ public final class ObjectConverter {
      * Converts the given value to a boolean, handling strings or Boolean objects; otherwise returning false if the
      * value could not be converted to a boolean
      */
-    @Converter
+    @Converter(order = 1)
     public static boolean toBool(Object value) {
         Boolean answer = toBoolean(value);
         if (answer == null) {
@@ -52,7 +52,7 @@ public final class ObjectConverter {
      * Converts the given value to a Boolean, handling strings or Boolean objects; otherwise returning null if the value
      * cannot be converted to a boolean
      */
-    @Converter
+    @Converter(order = 2)
     public static Boolean toBoolean(Object value) {
         return org.apache.camel.util.ObjectHelper.toBoolean(value);
     }
@@ -60,7 +60,7 @@ public final class ObjectConverter {
     /**
      * Creates an iterator over the value
      */
-    @Converter
+    @Converter(order = 3)
     public static Iterator<?> iterator(Object value) {
         return ObjectHelper.createIterator(value);
     }
@@ -68,7 +68,7 @@ public final class ObjectConverter {
     /**
      * Creates an iterable over the value
      */
-    @Converter
+    @Converter(order = 4)
     public static Iterable<?> iterable(Object value) {
         return ObjectHelper.createIterable(value);
     }
@@ -76,7 +76,7 @@ public final class ObjectConverter {
     /**
      * Returns the converted value, or null if the value is null
      */
-    @Converter(allowNull = true)
+    @Converter(order = 5, allowNull = true)
     public static Byte toByte(Number value) {
         if (org.apache.camel.util.ObjectHelper.isNaN(value)) {
             return null;
@@ -84,22 +84,22 @@ public final class ObjectConverter {
         return value.byteValue();
     }
 
-    @Converter
+    @Converter(order = 6)
     public static Byte toByte(String value) {
         return Byte.valueOf(value);
     }
 
-    @Converter
+    @Converter(order = 7)
     public static char[] toCharArray(String value) {
         return value.toCharArray();
     }
 
-    @Converter
+    @Converter(order = 8)
     public static Character toCharacter(String value) {
         return toChar(value);
     }
 
-    @Converter
+    @Converter(order = 9)
     public static char toChar(String value) {
         // must be string with the length of 1
         if (value.length() != 1) {
@@ -108,7 +108,7 @@ public final class ObjectConverter {
         return value.charAt(0);
     }
 
-    @Converter
+    @Converter(order = 10)
     public static String fromCharArray(char[] value) {
         return new String(value);
     }
@@ -116,7 +116,7 @@ public final class ObjectConverter {
     /**
      * Returns the converted value, or null if the value is null
      */
-    @Converter
+    @Converter(order = 11)
     public static Class<?> toClass(String value, Exchange exchange) {
         // prefer to use class resolver API
         if (exchange != null) {
@@ -129,7 +129,7 @@ public final class ObjectConverter {
     /**
      * Returns the converted value, or null if the value is null
      */
-    @Converter(allowNull = true)
+    @Converter(order = 12, allowNull = true)
     public static Short toShort(Number value) {
         if (org.apache.camel.util.ObjectHelper.isNaN(value)) {
             return null;
@@ -137,7 +137,7 @@ public final class ObjectConverter {
         return value.shortValue();
     }
 
-    @Converter
+    @Converter(order = 13)
     public static Short toShort(String value) {
         return Short.valueOf(value);
     }
@@ -145,7 +145,7 @@ public final class ObjectConverter {
     /**
      * Returns the converted value, or null if the value is null
      */
-    @Converter(allowNull = true)
+    @Converter(order = 14, allowNull = true)
     public static Integer toInteger(Number value) {
         if (org.apache.camel.util.ObjectHelper.isNaN(value)) {
             return null;
@@ -153,7 +153,7 @@ public final class ObjectConverter {
         return value.intValue();
     }
 
-    @Converter
+    @Converter(order = 15)
     public static Integer toInteger(String value) {
         return Integer.valueOf(value);
     }
@@ -161,7 +161,7 @@ public final class ObjectConverter {
     /**
      * Returns the converted value, or null if the value is null
      */
-    @Converter(allowNull = true)
+    @Converter(order = 16, allowNull = true)
     public static Long toLong(Number value) {
         if (org.apache.camel.util.ObjectHelper.isNaN(value)) {
             return null;
@@ -169,7 +169,7 @@ public final class ObjectConverter {
         return value.longValue();
     }
 
-    @Converter
+    @Converter(order = 17)
     public static Long toLong(String value) {
         return Long.valueOf(value);
     }
@@ -177,7 +177,7 @@ public final class ObjectConverter {
     /**
      * Returns the converted value, or null if the value is null
      */
-    @Converter(allowNull = true)
+    @Converter(order = 18, allowNull = true)
     public static BigInteger toBigInteger(Object value) {
         if (org.apache.camel.util.ObjectHelper.isNaN(value)) {
             return null;
@@ -201,7 +201,7 @@ public final class ObjectConverter {
     /**
      * Returns the converted value, or null if the value is null
      */
-    @Converter
+    @Converter(order = 19)
     public static Float toFloat(Number value) {
         if (org.apache.camel.util.ObjectHelper.isNaN(value)) {
             return Float.NaN;
@@ -209,7 +209,7 @@ public final class ObjectConverter {
         return value.floatValue();
     }
 
-    @Converter
+    @Converter(order = 20)
     public static Float toFloat(String value) {
         return Float.valueOf(value);
     }
@@ -217,7 +217,7 @@ public final class ObjectConverter {
     /**
      * Returns the converted value, or null if the value is null
      */
-    @Converter
+    @Converter(order = 21)
     public static Double toDouble(Number value) {
         if (org.apache.camel.util.ObjectHelper.isNaN(value)) {
             return Double.NaN;
@@ -225,44 +225,44 @@ public final class ObjectConverter {
         return value.doubleValue();
     }
 
-    @Converter
+    @Converter(order = 22)
     public static Double toDouble(String value) {
         return Double.valueOf(value);
     }
 
     // add fast type converters from most common used
 
-    @Converter
+    @Converter(order = 23)
     public static String toString(Integer value) {
         return value.toString();
     }
 
-    @Converter
+    @Converter(order = 24)
     public static String toString(Long value) {
         return value.toString();
     }
 
-    @Converter
+    @Converter(order = 25)
     public static String toString(Boolean value) {
         return value.toString();
     }
 
-    @Converter
+    @Converter(order = 26)
     public static String toString(StringBuffer value) {
         return value.toString();
     }
 
-    @Converter
+    @Converter(order = 27)
     public static String toString(StringBuilder value) {
         return value.toString();
     }
 
-    @Converter
+    @Converter(order = 28)
     public static Boolean toBoolean(String value) {
         return org.apache.camel.util.ObjectHelper.toBoolean(value);
     }
 
-    @Converter
+    @Converter(order = 29)
     public static Number toNumber(String text) {
         // what kind of numeric is it
         boolean dot = text.indexOf('.') != -1;
diff --git a/core/camel-base/src/main/java/org/apache/camel/converter/SQLConverter.java b/core/camel-base/src/main/java/org/apache/camel/converter/SQLConverter.java
index 60b671c..c47bee8 100644
--- a/core/camel-base/src/main/java/org/apache/camel/converter/SQLConverter.java
+++ b/core/camel-base/src/main/java/org/apache/camel/converter/SQLConverter.java
@@ -32,12 +32,12 @@ public final class SQLConverter {
     private SQLConverter() {
     }
 
-    @Converter
+    @Converter(order = 1)
     public static Timestamp toTimestamp(Long l) {
         return new Timestamp(l);
     }
 
-    @Converter
+    @Converter(order = 2)
     public static Long toLong(Timestamp ts) {
         return ts.getTime();
     }
diff --git a/core/camel-base/src/main/java/org/apache/camel/converter/UriTypeConverter.java b/core/camel-base/src/main/java/org/apache/camel/converter/UriTypeConverter.java
index 8b7b3ac..47f2878 100644
--- a/core/camel-base/src/main/java/org/apache/camel/converter/UriTypeConverter.java
+++ b/core/camel-base/src/main/java/org/apache/camel/converter/UriTypeConverter.java
@@ -33,12 +33,12 @@ public final class UriTypeConverter {
         // utility class
     }
 
-    @Converter
-    public static CharSequence toCharSequence(final URI value) {
+    @Converter(order = 1)
+    public static String toString(final URI value) {
         return value.toString();
     }
 
-    @Converter
+    @Converter(order = 2)
     public static URI toUri(final CharSequence value) {
         final String stringValue = String.valueOf(value);
 
diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/converter/UriTypeConverterTest.java b/core/camel-core/src/test/java/org/apache/camel/impl/converter/UriTypeConverterTest.java
index c0715d1..8dd45ccf 100644
--- a/core/camel-core/src/test/java/org/apache/camel/impl/converter/UriTypeConverterTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/impl/converter/UriTypeConverterTest.java
@@ -45,7 +45,7 @@ public class UriTypeConverterTest {
 
     @Test
     public void shouldConvertFromUrisToStrings() {
-        assertEquals(EXAMPLE, UriTypeConverter.toCharSequence(EXAMPLE_URI));
+        assertEquals(EXAMPLE, UriTypeConverter.toString(EXAMPLE_URI));
     }
 
 }
diff --git a/core/camel-support/src/main/java/org/apache/camel/converter/stream/StreamCacheConverter.java b/core/camel-support/src/main/java/org/apache/camel/converter/stream/StreamCacheConverter.java
index d8e1290..b919a95 100644
--- a/core/camel-support/src/main/java/org/apache/camel/converter/stream/StreamCacheConverter.java
+++ b/core/camel-support/src/main/java/org/apache/camel/converter/stream/StreamCacheConverter.java
@@ -41,12 +41,12 @@ public final class StreamCacheConverter {
     private StreamCacheConverter() {
     }
 
-    @Converter
+    @Converter(order = 1)
     public static StreamCache convertToStreamCache(ByteArrayInputStream stream, Exchange exchange) throws IOException {
         return new ByteArrayInputStreamCache(stream);
     }
 
-    @Converter
+    @Converter(order = 2)
     public static StreamCache convertToStreamCache(InputStream stream, Exchange exchange) throws IOException {
         // transfer the input stream to a cached output stream, and then creates a new stream cache view
         // of the data, which ensures the input stream is cached and re-readable.
@@ -55,18 +55,18 @@ public final class StreamCacheConverter {
         return cos.newStreamCache();
     }
 
-    @Converter
+    @Converter(order = 3)
     public static StreamCache convertToStreamCache(CachedOutputStream cos, Exchange exchange) throws IOException {
         return cos.newStreamCache();
     }
 
-    @Converter
+    @Converter(order = 4)
     public static StreamCache convertToStreamCache(Reader reader, Exchange exchange) throws IOException {
         String data = exchange.getContext().getTypeConverter().convertTo(String.class, exchange, reader);
         return new ReaderCache(data);
     }
 
-    @Converter
+    @Converter(order = 5)
     public static byte[] convertToByteArray(StreamCache cache, Exchange exchange) throws IOException {
         // lets serialize it as a byte array
         ByteArrayOutputStream os = new ByteArrayOutputStream();
@@ -74,7 +74,7 @@ public final class StreamCacheConverter {
         return os.toByteArray();
     }
 
-    @Converter
+    @Converter(order = 6)
     public static ByteBuffer convertToByteBuffer(StreamCache cache, Exchange exchange) throws IOException {
         byte[] array = convertToByteArray(cache, exchange);
         return ByteBuffer.wrap(array);
diff --git a/core/camel-xml-jaxp/src/main/java/org/apache/camel/converter/jaxp/DomConverter.java b/core/camel-xml-jaxp/src/main/java/org/apache/camel/converter/jaxp/DomConverter.java
index a9a5cde..dc9af03 100644
--- a/core/camel-xml-jaxp/src/main/java/org/apache/camel/converter/jaxp/DomConverter.java
+++ b/core/camel-xml-jaxp/src/main/java/org/apache/camel/converter/jaxp/DomConverter.java
@@ -48,7 +48,7 @@ public final class DomConverter {
         xml = new XmlConverter();
     }
 
-    @Converter
+    @Converter(order = 1)
     public String toString(NodeList nodeList, Exchange exchange) throws TransformerException {
         // converting NodeList to String is more tricky
         // sometimes the NodeList is a Node which we can then leverage
@@ -87,7 +87,7 @@ public final class DomConverter {
         return buffer.toString();
     }
 
-    @Converter
+    @Converter(order = 2)
     public String toString(Node node, Exchange exchange) throws TransformerException {
         String s;
         if (node instanceof Text) {
@@ -107,7 +107,7 @@ public final class DomConverter {
         return s;
     }
 
-    @Converter
+    @Converter(order = 3)
     public static Integer toInteger(NodeList nodeList) {
         StringBuilder buffer = new StringBuilder();
         append(buffer, nodeList);
@@ -115,7 +115,7 @@ public final class DomConverter {
         return Integer.valueOf(s);
     }
 
-    @Converter
+    @Converter(order = 4)
     public static Long toLong(NodeList nodeList) {
         StringBuilder buffer = new StringBuilder();
         append(buffer, nodeList);
@@ -123,7 +123,7 @@ public final class DomConverter {
         return Long.valueOf(s);
     }
 
-    @Converter
+    @Converter(order = 5)
     public static List<?> toList(NodeList nodeList) {
         List<Object> answer = new ArrayList<>();
         Iterator<?> it = ObjectHelper.createIterator(nodeList);
@@ -133,13 +133,13 @@ public final class DomConverter {
         return answer;
     }
 
-    @Converter
+    @Converter(order = 6)
     public InputStream toInputStream(NodeList nodeList, Exchange exchange)
             throws TransformerException, UnsupportedEncodingException {
         return new ByteArrayInputStream(toByteArray(nodeList, exchange));
     }
 
-    @Converter
+    @Converter(order = 7)
     public byte[] toByteArray(NodeList nodeList, Exchange exchange) throws TransformerException, UnsupportedEncodingException {
         String data = toString(nodeList, exchange);
         return data.getBytes(ExchangeHelper.getCharsetName(exchange));
diff --git a/core/camel-xml-jaxp/src/main/java/org/apache/camel/converter/jaxp/StaxConverter.java b/core/camel-xml-jaxp/src/main/java/org/apache/camel/converter/jaxp/StaxConverter.java
index c2da4e6..0d9a1f4 100644
--- a/core/camel-xml-jaxp/src/main/java/org/apache/camel/converter/jaxp/StaxConverter.java
+++ b/core/camel-xml-jaxp/src/main/java/org/apache/camel/converter/jaxp/StaxConverter.java
@@ -94,7 +94,7 @@ public class StaxConverter {
     private XMLInputFactory inputFactory;
     private XMLOutputFactory outputFactory;
 
-    @Converter
+    @Converter(order = 1)
     public XMLEventWriter createXMLEventWriter(OutputStream out, Exchange exchange) throws XMLStreamException {
         XMLOutputFactory factory = getOutputFactory();
         try {
@@ -104,7 +104,7 @@ public class StaxConverter {
         }
     }
 
-    @Converter
+    @Converter(order = 2)
     public XMLEventWriter createXMLEventWriter(Writer writer) throws XMLStreamException {
         XMLOutputFactory factory = getOutputFactory();
         try {
@@ -114,7 +114,7 @@ public class StaxConverter {
         }
     }
 
-    @Converter
+    @Converter(order = 3)
     public XMLEventWriter createXMLEventWriter(Result result) throws XMLStreamException {
         XMLOutputFactory factory = getOutputFactory();
         try {
@@ -124,7 +124,7 @@ public class StaxConverter {
         }
     }
 
-    @Converter
+    @Converter(order = 4)
     public XMLStreamWriter createXMLStreamWriter(OutputStream outputStream, Exchange exchange) throws XMLStreamException {
         XMLOutputFactory factory = getOutputFactory();
         try {
@@ -134,7 +134,7 @@ public class StaxConverter {
         }
     }
 
-    @Converter
+    @Converter(order = 5)
     public XMLStreamWriter createXMLStreamWriter(Writer writer) throws XMLStreamException {
         XMLOutputFactory factory = getOutputFactory();
         try {
@@ -144,7 +144,7 @@ public class StaxConverter {
         }
     }
 
-    @Converter
+    @Converter(order = 6)
     public XMLStreamWriter createXMLStreamWriter(Result result) throws XMLStreamException {
         XMLOutputFactory factory = getOutputFactory();
         try {
@@ -154,7 +154,7 @@ public class StaxConverter {
         }
     }
 
-    @Converter
+    @Converter(order = 7)
     public XMLStreamReader createXMLStreamReader(InputStream in, Exchange exchange) throws XMLStreamException {
         XMLInputFactory factory = getInputFactory();
         try {
@@ -169,7 +169,7 @@ public class StaxConverter {
         }
     }
 
-    @Converter
+    @Converter(order = 8)
     public XMLStreamReader createXMLStreamReader(File file, Exchange exchange)
             throws XMLStreamException, FileNotFoundException {
         XMLInputFactory factory = getInputFactory();
@@ -181,7 +181,7 @@ public class StaxConverter {
         }
     }
 
-    @Converter
+    @Converter(order = 9)
     public XMLStreamReader createXMLStreamReader(Reader reader) throws XMLStreamException {
         XMLInputFactory factory = getInputFactory();
         try {
@@ -191,7 +191,7 @@ public class StaxConverter {
         }
     }
 
-    @Converter
+    @Converter(order = 10)
     public XMLStreamReader createXMLStreamReader(Source in) throws XMLStreamException {
         XMLInputFactory factory = getInputFactory();
         try {
@@ -201,7 +201,7 @@ public class StaxConverter {
         }
     }
 
-    @Converter
+    @Converter(order = 11)
     public XMLStreamReader createXMLStreamReader(String string) throws XMLStreamException {
         XMLInputFactory factory = getInputFactory();
         try {
@@ -211,7 +211,7 @@ public class StaxConverter {
         }
     }
 
-    @Converter
+    @Converter(order = 12)
     public XMLEventReader createXMLEventReader(InputStream in, Exchange exchange) throws XMLStreamException {
         XMLInputFactory factory = getInputFactory();
         try {
@@ -226,7 +226,7 @@ public class StaxConverter {
         }
     }
 
-    @Converter
+    @Converter(order = 13)
     public XMLEventReader createXMLEventReader(File file, Exchange exchange) throws XMLStreamException, FileNotFoundException {
         XMLInputFactory factory = getInputFactory();
         try {
@@ -237,7 +237,7 @@ public class StaxConverter {
         }
     }
 
-    @Converter
+    @Converter(order = 14)
     public XMLEventReader createXMLEventReader(Reader reader) throws XMLStreamException {
         XMLInputFactory factory = getInputFactory();
         try {
@@ -247,7 +247,7 @@ public class StaxConverter {
         }
     }
 
-    @Converter
+    @Converter(order = 15)
     public XMLEventReader createXMLEventReader(XMLStreamReader reader) throws XMLStreamException {
         XMLInputFactory factory = getInputFactory();
         try {
@@ -257,7 +257,7 @@ public class StaxConverter {
         }
     }
 
-    @Converter
+    @Converter(order = 16)
     public XMLEventReader createXMLEventReader(Source in) throws XMLStreamException {
         XMLInputFactory factory = getInputFactory();
         try {
@@ -267,7 +267,7 @@ public class StaxConverter {
         }
     }
 
-    @Converter
+    @Converter(order = 17)
     public InputStream createInputStream(XMLStreamReader reader, Exchange exchange) {
         XMLOutputFactory factory = getOutputFactory();
         try {
@@ -278,7 +278,7 @@ public class StaxConverter {
         }
     }
 
-    @Converter
+    @Converter(order = 18)
     public Reader createReader(XMLStreamReader reader, Exchange exchange) {
         XMLOutputFactory factory = getOutputFactory();
         try {
diff --git a/core/camel-xml-jaxp/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java b/core/camel-xml-jaxp/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
index cf7ab88..6b9e7c7 100644
--- a/core/camel-xml-jaxp/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
+++ b/core/camel-xml-jaxp/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
@@ -108,14 +108,6 @@ public class XmlConverter {
     }
 
     /**
-     * Converts the given string to a QName.
-     */
-    @Converter
-    public QName toQName(String str) {
-        return QName.valueOf(str);
-    }
-
-    /**
      * Returns the default set of output properties for conversions.
      */
     public Properties defaultOutputProperties() {
@@ -154,9 +146,17 @@ public class XmlConverter {
     }
 
     /**
+     * Converts the given string to a QName.
+     */
+    @Converter(order = 1)
+    public QName toQName(String str) {
+        return QName.valueOf(str);
+    }
+
+    /**
      * Converts the given NodeList to a boolean
      */
-    @Converter
+    @Converter(order = 2)
     public Boolean toBoolean(NodeList list) {
         return list.getLength() > 0;
     }
@@ -164,7 +164,7 @@ public class XmlConverter {
     /**
      * Converts the given byte[] to a Source
      */
-    @Converter
+    @Converter(order = 3)
     public BytesSource toBytesSource(byte[] data) {
         return new BytesSource(data);
     }
@@ -172,7 +172,7 @@ public class XmlConverter {
     /**
      * Converts the given String to a Source
      */
-    @Converter
+    @Converter(order = 4)
     public StringSource toStringSource(String data) {
         return new StringSource(data);
     }
@@ -180,7 +180,7 @@ public class XmlConverter {
     /**
      * Converts the given Document to a DOMSource
      */
-    @Converter
+    @Converter(order = 5)
     public DOMSource toDOMSource(Document document) {
         return new DOMSource(document);
     }
@@ -188,7 +188,7 @@ public class XmlConverter {
     /**
      * Converts the given Node to a Source
      */
-    @Converter
+    @Converter(order = 6)
     public DOMSource toDOMSource(Node node) throws ParserConfigurationException, TransformerException {
         Document document = toDOMDocument(node);
         return new DOMSource(document);
@@ -197,7 +197,7 @@ public class XmlConverter {
     /**
      * Converts the given String to a Source
      */
-    @Converter
+    @Converter(order = 7)
     public Source toSource(String data) {
         return new StringSource(data);
     }
@@ -205,7 +205,7 @@ public class XmlConverter {
     /**
      * Converts the given input Source into text
      */
-    @Converter
+    @Converter(order = 8)
     public String toString(Source source, Exchange exchange) throws TransformerException {
         if (source == null) {
             return null;
@@ -233,7 +233,7 @@ public class XmlConverter {
     /**
      * Converts the given input Source into bytes
      */
-    @Converter
+    @Converter(order = 9)
     public byte[] toByteArray(Source source, Exchange exchange) throws TransformerException {
         if (source instanceof BytesSource) {
             return ((BytesSource) source).getData();
@@ -276,7 +276,7 @@ public class XmlConverter {
      * Converts the source instance to a {@link DOMSource} or returns null if the conversion is not supported (making it
      * easy to derive from this class to add new kinds of conversion).
      */
-    @Converter
+    @Converter(order = 10)
     public DOMSource toDOMSource(String text)
             throws ParserConfigurationException, IOException, SAXException, TransformerException {
         Source source = toSource(text);
@@ -287,7 +287,7 @@ public class XmlConverter {
      * Converts the source instance to a {@link DOMSource} or returns null if the conversion is not supported (making it
      * easy to derive from this class to add new kinds of conversion).
      */
-    @Converter
+    @Converter(order = 11)
     public DOMSource toDOMSource(byte[] bytes) throws IOException, SAXException, ParserConfigurationException {
         InputStream is = new ByteArrayInputStream(bytes);
         try {
@@ -301,7 +301,7 @@ public class XmlConverter {
      * Converts the source instance to a {@link SAXSource} or returns null if the conversion is not supported (making it
      * easy to derive from this class to add new kinds of conversion).
      */
-    @Converter
+    @Converter(order = 12)
     public SAXSource toSAXSource(String source, Exchange exchange) throws IOException, SAXException, TransformerException {
         return toSAXSource(toSource(source), exchange);
     }
@@ -310,7 +310,7 @@ public class XmlConverter {
      * Converts the source instance to a {@link StAXSource} or returns null if the conversion is not supported (making
      * it easy to derive from this class to add new kinds of conversion).
      */
-    @Converter
+    @Converter(order = 13)
     public StAXSource toStAXSource(String source, Exchange exchange) throws XMLStreamException {
         XMLStreamReader r = new StaxConverter().createXMLStreamReader(new StringReader(source));
         return new StAXSource(r);
@@ -320,7 +320,7 @@ public class XmlConverter {
      * Converts the source instance to a {@link StAXSource} or returns null if the conversion is not supported (making
      * it easy to derive from this class to add new kinds of conversion).
      */
-    @Converter
+    @Converter(order = 14)
     public StAXSource toStAXSource(byte[] in, Exchange exchange) throws XMLStreamException {
         XMLStreamReader r = new StaxConverter().createXMLStreamReader(new ByteArrayInputStream(in), exchange);
         return new StAXSource(r);
@@ -330,7 +330,7 @@ public class XmlConverter {
      * Converts the source instance to a {@link SAXSource} or returns null if the conversion is not supported (making it
      * easy to derive from this class to add new kinds of conversion).
      */
-    @Converter
+    @Converter(order = 15)
     public SAXSource toSAXSource(InputStream source, Exchange exchange) throws IOException, SAXException, TransformerException {
         return toSAXSource(toStreamSource(source), exchange);
     }
@@ -339,7 +339,7 @@ public class XmlConverter {
      * Converts the source instance to a {@link SAXSource} or returns null if the conversion is not supported (making it
      * easy to derive from this class to add new kinds of conversion).
      */
-    @Converter
+    @Converter(order = 16)
     public SAXSource toSAXSource(byte[] in, Exchange exchange) throws IOException, SAXException, TransformerException {
         return toSAXSource(toStreamSource(in, exchange), exchange);
     }
@@ -348,7 +348,7 @@ public class XmlConverter {
      * Converts the source instance to a {@link StAXSource} or returns null if the conversion is not supported (making
      * it easy to derive from this class to add new kinds of conversion).
      */
-    @Converter
+    @Converter(order = 17)
     public StAXSource toStAXSource(InputStream source, Exchange exchange) throws XMLStreamException {
         XMLStreamReader r = new StaxConverter().createXMLStreamReader(source, exchange);
         return new StAXSource(r);
@@ -358,7 +358,7 @@ public class XmlConverter {
      * Converts the source instance to a {@link SAXSource} or returns null if the conversion is not supported (making it
      * easy to derive from this class to add new kinds of conversion).
      */
-    @Converter
+    @Converter(order = 18)
     public SAXSource toSAXSource(File file, Exchange exchange) throws IOException, SAXException, TransformerException {
         InputStream is = IOHelper.buffered(new FileInputStream(file));
         return toSAXSource(is, exchange);
@@ -368,46 +368,46 @@ public class XmlConverter {
      * Converts the source instance to a {@link StAXSource} or returns null if the conversion is not supported (making
      * it easy to derive from this class to add new kinds of conversion).
      */
-    @Converter
+    @Converter(order = 19)
     public StAXSource toStAXSource(File file, Exchange exchange) throws FileNotFoundException, XMLStreamException {
         InputStream is = IOHelper.buffered(new FileInputStream(file));
         XMLStreamReader r = new StaxConverter().createXMLStreamReader(is, exchange);
         return new StAXSource(r);
     }
 
-    @Converter
+    @Converter(order = 20)
     public StreamSource toStreamSource(String in) {
         return new StreamSource(new ByteArrayInputStream(in.getBytes()));
     }
 
-    @Converter
+    @Converter(order = 21)
     public StreamSource toStreamSource(InputStream in) {
         return new StreamSource(in);
     }
 
-    @Converter
+    @Converter(order = 22)
     public StreamSource toStreamSource(Reader in) {
         return new StreamSource(in);
     }
 
-    @Converter
+    @Converter(order = 23)
     public StreamSource toStreamSource(File in) {
         return new StreamSource(in);
     }
 
-    @Converter
+    @Converter(order = 24)
     public StreamSource toStreamSource(byte[] in, Exchange exchange) throws TransformerException {
         InputStream is = exchange.getContext().getTypeConverter().convertTo(InputStream.class, exchange, in);
         return new StreamSource(is);
     }
 
-    @Converter
+    @Converter(order = 25)
     public StreamSource toStreamSource(ByteBuffer in, Exchange exchange) throws TransformerException {
         InputStream is = exchange.getContext().getTypeConverter().convertTo(InputStream.class, exchange, in);
         return new StreamSource(is);
     }
 
-    @Converter
+    @Converter(order = 26)
     public StreamSource toStreamSourceFromSAX(SAXSource source, Exchange exchange) throws TransformerException {
         InputSource inputSource = source.getInputSource();
         if (inputSource != null) {
@@ -422,19 +422,19 @@ public class XmlConverter {
         return new StringSource(result);
     }
 
-    @Converter
+    @Converter(order = 27)
     public StreamSource toStreamSourceFromDOM(DOMSource source, Exchange exchange) throws TransformerException {
         String result = toString(source, exchange);
         return new StringSource(result);
     }
 
-    @Converter
+    @Converter(order = 28)
     public StreamSource toStreamSourceFromStAX(StAXSource source, Exchange exchange) throws TransformerException {
         String result = toString(source, exchange);
         return new StringSource(result);
     }
 
-    @Converter
+    @Converter(order = 29)
     public SAXSource toSAXSourceFromStream(StreamSource source, Exchange exchange) throws SAXException {
         InputSource inputSource;
         if (source.getReader() != null) {
@@ -469,7 +469,7 @@ public class XmlConverter {
         return new SAXSource(xmlReader, inputSource);
     }
 
-    @Converter
+    @Converter(order = 30)
     public Reader toReader(StreamSource source) {
         Reader r = source.getReader();
         if (r == null) {
@@ -478,7 +478,7 @@ public class XmlConverter {
         return r;
     }
 
-    @Converter
+    @Converter(order = 31)
     public Reader toReaderFromSource(Source src, Exchange exchange) throws TransformerException {
         StreamSource stSrc = toStreamSource(src, exchange);
         Reader r = stSrc.getReader();
@@ -488,7 +488,7 @@ public class XmlConverter {
         return r;
     }
 
-    @Converter
+    @Converter(order = 32)
     public DOMSource toDOMSource(InputStream is, Exchange exchange)
             throws ParserConfigurationException, IOException, SAXException {
         InputSource source = new InputSource(is);
@@ -498,13 +498,13 @@ public class XmlConverter {
         return new DOMSource(document, systemId);
     }
 
-    @Converter
+    @Converter(order = 33)
     public DOMSource toDOMSource(File file, Exchange exchange) throws ParserConfigurationException, IOException, SAXException {
         InputStream is = IOHelper.buffered(new FileInputStream(file));
         return toDOMSource(is, exchange);
     }
 
-    @Converter
+    @Converter(order = 34)
     public DOMSource toDOMSourceFromStream(StreamSource source, Exchange exchange)
             throws ParserConfigurationException, IOException, SAXException {
         Document document;
@@ -527,33 +527,33 @@ public class XmlConverter {
         return new DOMSource(document, systemId);
     }
 
-    @Converter
+    @Converter(order = 35)
     public SAXSource toSAXSourceFromDOM(DOMSource source, Exchange exchange) throws TransformerException {
         String str = toString(source, exchange);
         StringReader reader = new StringReader(str);
         return new SAXSource(new InputSource(reader));
     }
 
-    @Converter
+    @Converter(order = 36)
     public SAXSource toSAXSourceFromStAX(StAXSource source, Exchange exchange) throws TransformerException {
         String str = toString(source, exchange);
         StringReader reader = new StringReader(str);
         return new SAXSource(new InputSource(reader));
     }
 
-    @Converter
+    @Converter(order = 37)
     public DOMSource toDOMSourceFromSAX(SAXSource source)
             throws IOException, SAXException, ParserConfigurationException, TransformerException {
         return new DOMSource(toDOMNodeFromSAX(source));
     }
 
-    @Converter
+    @Converter(order = 38)
     public DOMSource toDOMSourceFromStAX(StAXSource source)
             throws IOException, SAXException, ParserConfigurationException, TransformerException {
         return new DOMSource(toDOMNodeFromStAX(source));
     }
 
-    @Converter
+    @Converter(order = 39)
     public Node toDOMNodeFromSAX(SAXSource source)
             throws TransformerException {
         DOMResult result = new DOMResult();
@@ -561,7 +561,7 @@ public class XmlConverter {
         return result.getNode();
     }
 
-    @Converter
+    @Converter(order = 40)
     public Node toDOMNodeFromStAX(StAXSource source)
             throws TransformerException {
         DOMResult result = new DOMResult();
@@ -575,7 +575,7 @@ public class XmlConverter {
      * @param  nl the NodeList
      * @return    the DOM Node
      */
-    @Converter(allowNull = true)
+    @Converter(order = 41, allowNull = true)
     public Node toDOMNodeFromSingleNodeList(NodeList nl) {
         return nl.getLength() == 1 ? nl.item(0) : null;
     }
@@ -587,7 +587,7 @@ public class XmlConverter {
      * @param  nl the NodeList
      * @return    the DOM Document
      */
-    @Converter(allowNull = true)
+    @Converter(order = 42, allowNull = true)
     public Document toDOMDocumentFromSingleNodeList(NodeList nl) throws ParserConfigurationException, TransformerException {
         if (nl.getLength() == 1) {
             return toDOMDocument(nl.item(0));
@@ -603,7 +603,7 @@ public class XmlConverter {
     /**
      * Converts the given TRaX Source into a W3C DOM node
      */
-    @Converter(allowNull = true)
+    @Converter(order = 43, allowNull = true)
     public Node toDOMNode(Source source) throws TransformerException, ParserConfigurationException, IOException, SAXException {
         DOMSource domSrc = toDOMSource(source, null);
         return domSrc != null ? domSrc.getNode() : null;
@@ -612,7 +612,7 @@ public class XmlConverter {
     /**
      * Create a DOM element from the given source.
      */
-    @Converter
+    @Converter(order = 44)
     public Element toDOMElement(Source source)
             throws TransformerException, ParserConfigurationException, IOException, SAXException {
         Node node = toDOMNode(source);
@@ -623,7 +623,7 @@ public class XmlConverter {
      * Create a DOM element from the DOM node. Simply cast if the node is an Element, or return the root element if it
      * is a Document.
      */
-    @Converter
+    @Converter(order = 45)
     public Element toDOMElement(Node node) throws TransformerException {
         // If the node is an document, return the root element
         if (node instanceof Document) {
@@ -644,7 +644,7 @@ public class XmlConverter {
      * @param  exchange is the exchange to be used when calling the converter
      * @return          the parsed document
      */
-    @Converter
+    @Converter(order = 46)
     public Document toDOMDocument(byte[] data, Exchange exchange)
             throws IOException, SAXException, ParserConfigurationException {
         DocumentBuilder documentBuilder = createDocumentBuilder(getDocumentBuilderFactory(exchange));
@@ -658,7 +658,7 @@ public class XmlConverter {
      * @param  exchange is the exchange to be used when calling the converter
      * @return          the parsed document
      */
-    @Converter
+    @Converter(order = 47)
     public Document toDOMDocument(InputStream in, Exchange exchange)
             throws IOException, SAXException, ParserConfigurationException {
         DocumentBuilder documentBuilder = createDocumentBuilder(getDocumentBuilderFactory(exchange));
@@ -679,7 +679,7 @@ public class XmlConverter {
      * @param  exchange is the exchange to be used when calling the converter
      * @return          the parsed document
      */
-    @Converter
+    @Converter(order = 48)
     public Document toDOMDocument(Reader in, Exchange exchange) throws IOException, SAXException, ParserConfigurationException {
         return toDOMDocument(new InputSource(in), exchange);
     }
@@ -691,7 +691,7 @@ public class XmlConverter {
      * @param  exchange is the exchange to be used when calling the converter
      * @return          the parsed document
      */
-    @Converter
+    @Converter(order = 49)
     public Document toDOMDocument(InputSource in, Exchange exchange)
             throws IOException, SAXException, ParserConfigurationException {
         DocumentBuilder documentBuilder = createDocumentBuilder(getDocumentBuilderFactory(exchange));
@@ -705,7 +705,7 @@ public class XmlConverter {
      * @param  exchange is the exchange to be used when calling the converter
      * @return          the parsed document
      */
-    @Converter
+    @Converter(order = 50)
     public Document toDOMDocument(String text, Exchange exchange)
             throws IOException, SAXException, ParserConfigurationException {
         return toDOMDocument(new StringReader(text), exchange);
@@ -718,7 +718,7 @@ public class XmlConverter {
      * @param  exchange is the exchange to be used when calling the converter
      * @return          the parsed document
      */
-    @Converter
+    @Converter(order = 51)
     public Document toDOMDocument(File file, Exchange exchange) throws IOException, SAXException, ParserConfigurationException {
         DocumentBuilder documentBuilder = createDocumentBuilder(getDocumentBuilderFactory(exchange));
         return documentBuilder.parse(file);
@@ -727,7 +727,7 @@ public class XmlConverter {
     /**
      * Create a DOM document from the given source.
      */
-    @Converter
+    @Converter(order = 52)
     public Document toDOMDocument(Source source)
             throws TransformerException, ParserConfigurationException, IOException, SAXException {
         Node node = toDOMNode(source);
@@ -740,7 +740,7 @@ public class XmlConverter {
      * If the node is an document, just cast it, if the node is an root element, retrieve its owner element or create a
      * new document and import the node.
      */
-    @Converter
+    @Converter(order = 53)
     public Document toDOMDocument(final Node node) throws ParserConfigurationException, TransformerException {
         ObjectHelper.notNull(node, "node");
 
@@ -769,22 +769,22 @@ public class XmlConverter {
         }
     }
 
-    @Converter
+    @Converter(order = 54)
     public InputStream toInputStream(DOMSource source, Exchange exchange) throws TransformerException {
         return new ByteArrayInputStream(toByteArray(source, exchange));
     }
 
-    @Converter
+    @Converter(order = 55)
     public InputStream toInputStream(Document dom, Exchange exchange) throws TransformerException {
         return toInputStream(new DOMSource(dom), exchange);
     }
 
-    @Converter
+    @Converter(order = 56)
     public InputSource toInputSource(InputStream is, Exchange exchange) {
         return new InputSource(is);
     }
 
-    @Converter
+    @Converter(order = 57)
     public InputSource toInputSource(File file, Exchange exchange) throws FileNotFoundException {
         InputStream is = IOHelper.buffered(new FileInputStream(file));
         return new InputSource(is);
@@ -794,7 +794,7 @@ public class XmlConverter {
      * Converts the source instance to a {@link DOMSource} or returns null if the conversion is not supported (making it
      * easy to derive from this class to add new kinds of conversion).
      */
-    @Converter
+    @Converter(order = 58)
     public DOMSource toDOMSource(Source source, Exchange exchange)
             throws ParserConfigurationException, IOException, SAXException, TransformerException {
         if (source instanceof DOMSource) {
@@ -814,7 +814,7 @@ public class XmlConverter {
      * Converts the source instance to a {@link SAXSource} or returns null if the conversion is not supported (making it
      * easy to derive from this class to add new kinds of conversion).
      */
-    @Converter
+    @Converter(order = 59)
     public SAXSource toSAXSource(Source source, Exchange exchange) throws IOException, SAXException, TransformerException {
         if (source instanceof SAXSource) {
             return (SAXSource) source;
@@ -829,7 +829,7 @@ public class XmlConverter {
         }
     }
 
-    @Converter
+    @Converter(order = 60)
     public StreamSource toStreamSource(Source source, Exchange exchange) throws TransformerException {
         if (source instanceof StreamSource) {
             return (StreamSource) source;
@@ -844,7 +844,7 @@ public class XmlConverter {
         }
     }
 
-    @Converter
+    @Converter(order = 61)
     public InputStream toInputStream(StreamSource source) throws IOException {
         InputStream is = source.getInputStream();
         if (is == null) {
diff --git a/core/camel-xml-jaxp/src/main/java/org/apache/camel/util/xml/StreamSourceConverter.java b/core/camel-xml-jaxp/src/main/java/org/apache/camel/util/xml/StreamSourceConverter.java
index 994e1db..2b3fb90 100644
--- a/core/camel-xml-jaxp/src/main/java/org/apache/camel/util/xml/StreamSourceConverter.java
+++ b/core/camel-xml-jaxp/src/main/java/org/apache/camel/util/xml/StreamSourceConverter.java
@@ -42,24 +42,24 @@ public final class StreamSourceConverter {
     private StreamSourceConverter() {
     }
 
-    @Converter
+    @Converter(order = 1)
     public static StreamCache convertToStreamCache(BytesSource source) {
         //no need to do stream caching for a BytesSource
         return null;
     }
 
-    @Converter
+    @Converter(order = 2)
     public static StreamCache convertToStreamCache(StreamSource source, Exchange exchange) throws IOException {
         return new StreamSourceCache(source, exchange);
     }
 
-    @Converter
+    @Converter(order = 3)
     public static StreamCache convertToStreamCache(SAXSource source, Exchange exchange) throws TransformerException {
         String data = exchange.getContext().getTypeConverter().convertTo(String.class, exchange, source);
         return new SourceCache(data);
     }
 
-    @Converter
+    @Converter(order = 4)
     public static Serializable convertToSerializable(StreamCache cache, Exchange exchange) throws IOException {
         byte[] data = convertToByteArray(cache, exchange);
         return new BytesSource(data);