Henri Biestro created JEXL-392:
----------------------------------
Summary: Enable namespace declaration based on scripts
Key: JEXL-392
URL: https://issues.apache.org/jira/browse/JEXL-392
Project: Commons JEXL
Issue Type: Improvement
Affects Versions: 3.2.1
Reporter: Henri Biestro
Assignee: Henri Biestro
Fix For: 3.3
WHAT:
It is often convenient to reuse pieces of code in multiple places. This is easy
to do with namespaces and Java classes (or objects) but impossible through
scripts. The workaround Is to use maps that contain the various functions and
use an object but it requires re-evaluating the script each time this is needed
which is costly.
Ideally, there should be a way to declare a namespace whose bound object would
be the result of the evaluation of JEXL code.
HOW:
By adding a new pragma imaginatively called 'module' behaving as namespace
declaration but whose value must be an expression (as a string) that will be
evaluated during pragma processing.
One important usage warning here is the idem-potence of the expression whose
result should be stable to avoid any bizarre behaviour.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)