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

The ability to declare indexed property getter/setter in customised JexlArithmetic implementation

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.0
    • 3.1
    • None

    Description

      At the moment we have the ability to declare a specific getter/setter method in customized JexlArithmetic class that will be used by Jexl engine when engine tries to get access to a property of some object. This is great extension point of the Jexl but I have come to a situation where I need the same technics to be applied to indexed properties. For example I'm scripting org.w3c.dom.Element object by setting its attributes via its

      Element.setAttribute(java.lang.String name, java.lang.String value) 

      method. In Jexl I use standard indexed property access syntax like the following:

       node.attribute.id = "12345"; 

      The problem lies with the last argument of the setAttribute method which is of String class. And for Jexl standard indexed property setter to work I should always remember that in script I need to cast specified property value to a string, which is error-prone and lacks, in my understanding, scripting easiness. I see the solution as to introduce custom indexed property setter in more generalized form, accepting Object type as a value so it could cast a value to String before calling Element.setAttribute

      Attachments

        Activity

          People

            henrib Henri Biestro
            dmitri_blinov Dmitri Blinov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: