users@el-spec.java.net

[el-spec users] [jsr341-experts] Expression evaluation listener

From: Kin-man Chung <kinman.chung_at_oracle.com>
Date: Mon, 14 May 2012 14:51:22 -0700

The wiki page

     http://java.net/projects/el-spec/pages/EvaluationListener

documents the current proposal. An internal user raised a couple of
questions and I provided the following answers.

1. When is EvaluationListener#beforeEvaluation called?

    A. The method is not called when the EL expression is parsed, and is
called when the one of the following method is called.
         ValueExpression#getValue
         ValueExpression#setValue
         MethodEpxression#invoke

         EvaluationListener#afterEvaluation is called before returning
from the above methods.

2. What information is available in EvaluationEvent? Can an user find
out more about the expression being evaluated so that he can watch out
for the expressions he is interested?

     A. Current proposed EvaluationEvent only includes the expression
string and ELContext. It is hard to determine what information an user
may want to find out about the expression being evaluated. One
possibility is to provide an AST for the expression which may allow the
user to extract the relevant info. ValueExpression or MethodExpression
is usually implemented with ASTs, but that is not required by the spec.

Come to think of it, EvaluationEnvent should also include info like
which of the 3 method triggers the event, and the result of the
evaluation (from afterEvaluation).

Please let me know if you have other insights.

Kin-man