Author: davsclaus
Date: Fri Mar 25 16:53:17 2011
New Revision: 1085466
URL: http://svn.apache.org/viewvc?rev=1085466&view=rev
Log:
CAMEL-3515: Polished and added wiki tags for docu.
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanOverloadedMethodTest.java
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java?rev=1085466&r1=1085465&r2=1085466&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
Fri Mar 25 16:53:17 2011
@@ -141,7 +141,7 @@ public class BeanInfo {
}
public MethodInvocation createInvocation(Object pojo, Exchange exchange)
- throws AmbiguousMethodCallException, MethodNotFoundException,
ClassNotFoundException {
+ throws AmbiguousMethodCallException, MethodNotFoundException {
MethodInfo methodInfo = null;
String methodName =
exchange.getIn().getHeader(Exchange.BEAN_METHOD_NAME, String.class);
@@ -371,9 +371,8 @@ public class BeanInfo {
* @param name an optional name of the method that must match, use
<tt>null</tt> to indicate all methods
* @return the method to invoke or null if no definitive method could be
matched
* @throws AmbiguousMethodCallException is thrown if cannot chose method
due to ambiguous
- * @throws ClassNotFoundException is thrown if name contains parameter
types to use as qualifier and a class was not found
*/
- protected MethodInfo chooseMethod(Object pojo, Exchange exchange, String
name) throws AmbiguousMethodCallException, ClassNotFoundException {
+ protected MethodInfo chooseMethod(Object pojo, Exchange exchange, String
name) throws AmbiguousMethodCallException {
// @Handler should be select first
// then any single method that has a custom @annotation
// or any single method that has a match parameter type that matches
the Exchange payload
@@ -684,7 +683,7 @@ public class BeanInfo {
}
}
- private void removeNonMatchingMethods(List<MethodInfo> methods, String
name) throws ClassNotFoundException {
+ private void removeNonMatchingMethods(List<MethodInfo> methods, String
name) {
Iterator<MethodInfo> it = methods.iterator();
while (it.hasNext()) {
MethodInfo info = it.next();
@@ -695,7 +694,7 @@ public class BeanInfo {
}
}
- private boolean matchMethod(Method method, String methodName) throws
ClassNotFoundException {
+ private boolean matchMethod(Method method, String methodName) {
if (methodName == null) {
return true;
}
Modified:
camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanOverloadedMethodTest.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanOverloadedMethodTest.java?rev=1085466&r1=1085465&r2=1085466&view=diff
==============================================================================
---
camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanOverloadedMethodTest.java
(original)
+++
camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanOverloadedMethodTest.java
Fri Mar 25 16:53:17 2011
@@ -73,10 +73,11 @@ public class BeanOverloadedMethodTest ex
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
+ // START SNIPPET: e2
from("direct:start")
.bean(MyBean.class, "hello(String,String)")
.to("mock:result");
-
+ // END SNIPPET: e2
}
});
context.start();
@@ -107,6 +108,26 @@ public class BeanOverloadedMethodTest ex
assertMockEndpointsSatisfied();
}
+ public void testHelloOverloadedWildcardWildcard() throws Exception {
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ // START SNIPPET: e3
+ from("direct:start")
+ .bean(MyBean.class, "hello(*,*)")
+ .to("mock:result");
+ // END SNIPPET: e2
+ }
+ });
+ context.start();
+
+ getMockEndpoint("mock:result").expectedBodiesReceived("Hello Claus you
are from Denmark");
+
+ template.sendBodyAndHeader("direct:start", "Claus", "country",
"Denmark");
+
+ assertMockEndpointsSatisfied();
+ }
+
public void testHelloOverloadedPickCamelAnnotated() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
@@ -227,6 +248,8 @@ public class BeanOverloadedMethodTest ex
assertMockEndpointsSatisfied();
}
+
+ // START SNIPPET: e1
public static final class MyBean {
public String hello(String name) {
@@ -269,4 +292,6 @@ public class BeanOverloadedMethodTest ex
}
}
+ // END SNIPPET: e1
+
}