You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by js...@apache.org on 2009/02/18 13:57:36 UTC
svn commit: r745504 -
/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java
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;
+ }
}