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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to