[ 
https://issues.apache.org/jira/browse/CAMEL-6848?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13832405#comment-13832405
 ] 

Jan Matèrne commented on CAMEL-6848:
------------------------------------

I did some experiments and calling a vararg-method is possible. But you have to 
pass an array instead of several single arguments.
When you are able to do most of the calls with plain Camel calling varargs is 
more complicated. (I think you are mentioning that).
In the meanwhile implementing a thin CallingBean for these kinds of methods 
should be the best strategy ...

> Enable vararg support for beaninvocation with Simple 
> -----------------------------------------------------
>
>                 Key: CAMEL-6848
>                 URL: https://issues.apache.org/jira/browse/CAMEL-6848
>             Project: Camel
>          Issue Type: Improvement
>          Components: bean-integration
>    Affects Versions: 2.11.1
>            Reporter: Roman Vottner
>            Priority: Minor
>              Labels: Simple, beaninvocation, vararg
>         Attachments: BeanCallTest.java
>
>
> Having a simple bean method that accepts multiple String parameters declared 
> as varargs, I'm having issues sending values from .bean(MyBean.class, "${ 
> foo('a','b') }") or .bean(MyBean.class, "${ foo(new String[] {'a', 'b'}) }") 
> to my bean directly. The error states that it can't convert from String to 
> String[] - but even with declaring a String[] (like the second bean 
> invocation) it is not able to execute the bean.
> The bean class simply looks like this:
> public MyBean
> {
>     public void foo(String ... param)
>     {
>         // do some stuff ...
>     }
> }
> I'd need to specify multiple parameters and to avoid creating multiple 
> classes or methods which are simply copy&paste classes with small adaptions 
> (inheritance is in place) I'd love to have a more generic approach in place. 
> If resource intensive calculations are done in the back running the method 
> multiple times with changed parameters may not be the best solution imho.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to