commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "AC (JIRA)" <j...@apache.org>
Subject [jira] Created: (JEXL-21) operator overloading / hooks on operator processing
Date Tue, 19 Sep 2006 15:17:27 GMT
operator overloading / hooks on operator processing
---------------------------------------------------

                 Key: JEXL-21
                 URL: http://issues.apache.org/jira/browse/JEXL-21
             Project: Commons JEXL
          Issue Type: New Feature
            Reporter: AC


I'd like to use JEXL for a website framework. In order to make the scripting code easy readable
it would be nice to let the users add hooks in the expression processing.
such a hook would allow me to add Date operators for example: Date  and Durations addition/substraction.

that would've been very easy for me to implement if I had access to the processing done in
let's say ASTAddNode class. 

An easy way to do it is to add a method in the parser like
registerHook(Class astNodeClass, SimpleNode hook)

in ExpressionImpl.evaluate we call node.implValue instead of value. This method can check
if  hooks where registered for the class and call for each hook.value before calling the value
of the node itself. 
For perfomance reasons the list of these hooks can be stored by the each SimpleNode in the
constructor SimpleNode(Parser p, int i) 

that's it, thanks


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


Mime
View raw message