camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r745504 - /camel/trunk/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java
Date Wed, 18 Feb 2009 12:57:36 GMT
Author: jstrachan
Date: Wed Feb 18 12:57:36 2009
New Revision: 745504

URL: http://svn.apache.org/viewvc?rev=745504&view=rev
Log:
added helper method

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java?rev=745504&r1=745503&r2=745504&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java Wed Feb
18 12:57:36 2009
@@ -389,4 +389,18 @@
     public static <T> T lookupBean(Exchange exchange, String name, Class<T> type)
{
         return exchange.getContext().getRegistry().lookup(name, type);
     }
+
+    /**
+     * Returns the first exchange in the given collection of exchanges which has the same
exchange ID as the one given
+     * or null if none could be found
+     */
+    public static Exchange getExchangeById(Iterable<Exchange> exchanges, String exchangeId)
{
+        for (Exchange exchange : exchanges) {
+            String id = exchange.getExchangeId();
+            if (id != null && id.equals(exchangeId)) {
+                return exchange;
+            }
+        }
+        return null;
+    }
 }



Mime
View raw message