Uploaded image for project: 'Commons JEXL'
  1. Commons JEXL
  2. JEXL-21

operator overloading / hooks on operator processing

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.0
    • None

    Description

      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

      Attachments

        Activity

          People

            Unassigned Unassigned
            acraciun@flashmail.com AC
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: