commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Biestro (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JEXL-21) operator overloading / hooks on operator processing
Date Fri, 17 Jul 2009 14:54:15 GMT

    [ https://issues.apache.org/jira/browse/JEXL-21?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12732556#action_12732556
] 

Henri Biestro commented on JEXL-21:
-----------------------------------

In 2.0, the Arithmetic instance does handle all arithmetic & logical operation; since
Arithmetic is an interface and the JexlEngine ctor can use such an instance, it is therefore
possible to implement the desired behavior.

> operator overloading / hooks on operator processing
> ---------------------------------------------------
>
>                 Key: JEXL-21
>                 URL: https://issues.apache.org/jira/browse/JEXL-21
>             Project: Commons JEXL
>          Issue Type: New Feature
>            Reporter: AC
>             Fix For: 2.0
>
>
> 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.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message