You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Your Name <ne...@tcs.com.ve> on 2004/12/08 19:53:41 UTC

JEXL Questions

Hi

I've been checking out JEXL and is very easy to use. I was wondering if 
I can do the following things:

1.- Define an expression and then reuse that expression as a function. 
I want to be able to let users configure their own expressions and then 
reuse them in another expression. Something like this:

Function TRIANGLEAREA: (a * b) / 2.
Reuse the function: a + TRIANGLEAREA (a, b) + b. 

2.- For a particular expression know what variables depend on the 
expression. I want to be able to expose the expression as a function 
with parameters.

Regards,

Nestor Boscan
-- 
NeoMail - http://neomail.sourceforge.net

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


RE: JEXL Questions

Posted by Hans Gilde <hg...@earthlink.net>.
For (1), it sounds to me like you want to put the result of TRIANGLEAREA in
a variable in the JexlContext and pass that context into a second JEXL
expression?

For (2), you can't (well, you can, but not easily) find the variables in the
expression programmatically. However, if you know the variables a priori,
you can write a function that takes those variables and puts them into the
context. If you don't know them, you can just pass a Map of variables into
the context.

-----Original Message-----
From: Your Name [mailto:nestor.boscan@tcs.com.ve] 
Sent: Wednesday, December 08, 2004 1:54 PM
To: commons-user@jakarta.apache.org
Subject: JEXL Questions

Hi

I've been checking out JEXL and is very easy to use. I was wondering if 
I can do the following things:

1.- Define an expression and then reuse that expression as a function. 
I want to be able to let users configure their own expressions and then 
reuse them in another expression. Something like this:

Function TRIANGLEAREA: (a * b) / 2.
Reuse the function: a + TRIANGLEAREA (a, b) + b. 

2.- For a particular expression know what variables depend on the 
expression. I want to be able to expose the expression as a function 
with parameters.

Regards,

Nestor Boscan
-- 
NeoMail - http://neomail.sourceforge.net

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org