You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by javamonkey79 <ja...@gmail.com> on 2013/06/20 22:05:39 UTC

List contains in Simple?

Is it possible to do a list.contains in the simple language?

I had something like this: 

<simple>${body.get("KEY")} in ${bean:listRef}</simple>

But it did not work. (My body object was a Map, listRef was an ArrayList).

Thinking back, the only thing that I might have done wrong is that the Map
was <String, Object> whereas the ArrayList was <String> - maybe that caused
the mismatch?



--
View this message in context: http://camel.465427.n5.nabble.com/List-contains-in-Simple-tp5734458.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: List contains in Simple?

Posted by Christian Müller <ch...@gmail.com>.
In general: http://camel.apache.org/scripting-languages.html

In detail:
http://camel.apache.org/beanshell.html
http://camel.apache.org/javascript.html
http://camel.apache.org/groovy.html
http://camel.apache.org/python.html
http://camel.apache.org/php.html
http://camel.apache.org/ruby.html
http://camel.apache.org/mvel.html

Best,
Christian
-----------------

Software Integration Specialist

Apache Camel committer: https://camel.apache.org/team
V.P. Apache Camel: https://www.apache.org/foundation/
Apache Member: https://www.apache.org/foundation/members.html

https://www.linkedin.com/pub/christian-mueller/11/551/642


On Thu, Jun 20, 2013 at 11:53 PM, javamonkey79 <ja...@gmail.com>wrote:

> I guess that is why it is called "simple" :)
>
> Can you inject in properties (body, exchange properties, etc.) in to other
> language expressions then? Is there an example out there similar to what I
> am trying to do?
>
> Thanks!
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/List-contains-in-Simple-tp5734458p5734491.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: List contains in Simple?

Posted by javamonkey79 <ja...@gmail.com>.
I guess that is why it is called "simple" :)

Can you inject in properties (body, exchange properties, etc.) in to other
language expressions then? Is there an example out there similar to what I
am trying to do?

Thanks!



--
View this message in context: http://camel.465427.n5.nabble.com/List-contains-in-Simple-tp5734458p5734491.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: List contains in Simple?

Posted by Christian Müller <ch...@gmail.com>.
For this, you have to use a more powerful script language.

Best,
Christian

Sent from a mobile device
Am 20.06.2013 22:25 schrieb "javamonkey79" <ja...@gmail.com>:

> I tried adding toString on and it did not work either...
>
> <simple>${body.get("KEY").toString()} in ${bean:test}</simple>
>
> Is this possible to do?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/List-contains-in-Simple-tp5734458p5734470.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: List contains in Simple?

Posted by javamonkey79 <ja...@gmail.com>.
I tried adding toString on and it did not work either...

<simple>${body.get("KEY").toString()} in ${bean:test}</simple>

Is this possible to do?



--
View this message in context: http://camel.465427.n5.nabble.com/List-contains-in-Simple-tp5734458p5734470.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: List contains in Simple?

Posted by Claus Ibsen <cl...@gmail.com>.
bean is to invoke a method on a bean, eg just like the bean component

ref is to refer to a bean "as-is" in the registry.

On Sun, Jun 23, 2013 at 4:32 AM, javamonkey79 <ja...@gmail.com> wrote:
> Yes, that works. What is the simple bean used for then? e.g. what's the
> difference between bean and ref in this instance... or why won't bean work?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/List-contains-in-Simple-tp5734458p5734580.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: List contains in Simple?

Posted by javamonkey79 <ja...@gmail.com>.
Yes, that works. What is the simple bean used for then? e.g. what's the
difference between bean and ref in this instance... or why won't bean work?



--
View this message in context: http://camel.465427.n5.nabble.com/List-contains-in-Simple-tp5734458p5734580.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: List contains in Simple?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

If you want to refer to a bean in the registry then use ref: eg

<simple>${body.get("KEY")} in ${ref:listRef}</simple>

Then it works fine.



On Thu, Jun 20, 2013 at 10:05 PM, javamonkey79 <ja...@gmail.com> wrote:
> Is it possible to do a list.contains in the simple language?
>
> I had something like this:
>
> <simple>${body.get("KEY")} in ${bean:listRef}</simple>
>
> But it did not work. (My body object was a Map, listRef was an ArrayList).
>
> Thinking back, the only thing that I might have done wrong is that the Map
> was <String, Object> whereas the ArrayList was <String> - maybe that caused
> the mismatch?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/List-contains-in-Simple-tp5734458.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen