You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by orz <vl...@gmail.com> on 2012/12/24 05:45:52 UTC

Possible to evaulate a expression without exchange?

Hi,

Basically I just want to retrieve the property value during runtime.

E.g. 
int number = SimpleBuilder.simple("${properties:number}").evaluate(exchange,
Integer.class);

Is there a way for me to do so without the presence of exchange?



--
View this message in context: http://camel.465427.n5.nabble.com/Possible-to-evaulate-a-expression-without-exchange-tp5724570.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Possible to evaulate a expression without exchange?

Posted by Willem jiang <wi...@gmail.com>.
No, I'm afraid you need to provide the exchange for the expression.  



--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Monday, December 24, 2012 at 12:45 PM, orz wrote:

> Hi,
>  
> Basically I just want to retrieve the property value during runtime.
>  
> E.g.  
> int number = SimpleBuilder.simple("${properties:number}").evaluate(exchange,
> Integer.class);
>  
> Is there a way for me to do so without the presence of exchange?
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Possible-to-evaulate-a-expression-without-exchange-tp5724570.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).




Re: Possible to evaulate a expression without exchange?

Posted by orz <vl...@gmail.com>.
Great thanks, that is what I need.

P/S sorry Claus, I accidentally emailed you instead of posting to this
thread



--
View this message in context: http://camel.465427.n5.nabble.com/Possible-to-evaulate-a-expression-without-exchange-tp5724570p5724586.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Possible to evaulate a expression without exchange?

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Dec 24, 2012 at 5:45 AM, orz <vl...@gmail.com> wrote:
> Hi,
>
> Basically I just want to retrieve the property value during runtime.
>

You can use the API on CamelContext, there is a
resolvePropertyPlaceholders method.
Thought it returns the value as a String, which you would need to
convert to an int afterwards

String val = camelContext.resolvePropertyPlaceholders("{{number}}");



> E.g.
> int number = SimpleBuilder.simple("${properties:number}").evaluate(exchange,
> Integer.class);
>
> Is there a way for me to do so without the presence of exchange?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Possible-to-evaulate-a-expression-without-exchange-tp5724570.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
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