camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mathieu Lalonde (Commented) (JIRA)" <>
Subject [jira] [Commented] (CAMEL-4541) Bean Binding should support interface methods for non-public classes
Date Thu, 13 Oct 2011 23:44:11 GMT


Mathieu Lalonde commented on CAMEL-4541:

After trying a simple fix, I take back my comment about preferring interface methods to class
methods since this breaks the component's annotation support.
I have a simple patch in the works that only prefers interface methods if the bean's class
is public.  Since Camel would not have been able to "bean bind" a non-public class anyways,
this avoids breaking the annotation support on beans.
> Bean Binding should support interface methods for non-public classes
> --------------------------------------------------------------------
>                 Key: CAMEL-4541
>                 URL:
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>            Reporter: Mathieu Lalonde
>            Assignee: Mathieu Lalonde
>            Priority: Minor
>             Fix For: Future
> As a user, I'd like to be able to use bean binding for non public classes.
> Bean binding is a strong selling point for Camel so it would be nice to have it work
for non-public classes as well, provided that the target method is available via an implemented
> eg.
> {code}
> // return private implementation of FooInterface
> FooInterface foo = Foos.newInstance();
> // works fine with plain java
> foo.doStuff("Hello");
> ...
> // This will throw an exception at runtime stating that the method can't be invoked (Illegal
> from("direct:start").bean(foo, "doStuff").mock("direct:result");
> {code}
> The Bean component should at the very least prefer interface methods (which won't cause
the above exception) to class methods when a matching method is available on both the class
and its interfaces (it currently ignore interface methods).
> On a side note, its probably faster to look for interface methods first since there are
usually less of them.
> I'll attach a unit test and patch soon.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message