To parse or evaluate an Expression, an ELContext
must be provided. The ELContext holds:
FunctionMapper that will be used
to resolve EL Functions. This is used only in parsing.VariableMapper that will be used
to resolve EL Variables. This is used only in parsing.ELResolver that will be consulted
to resolve model objects and their propertiesELResolversImportHandler that will be consulted to
resolve classes that have been importedLambdaExpressionsThe collection of context objects is necessary because each
ELResolver may need access to a different context object.
For example, JSP and Faces resolvers need access to a
javax.servlet.jsp.JspContext and a
javax.faces.context.FacesContext, respectively.
When used in a web container, the creation of
ELContext objects is controlled through
the underlying technology. For example, in JSP the
JspContext.getELContext() factory method is used.
Some technologies provide the ability to add an ELContextListener
so that applications and frameworks can ensure their own context objects
are attached to any newly created ELContext.
When used in a stand-alone environment, StandardELContext
provides a default ELContext, which is managed and modified
by ELManager.
Because it stores state during expression evaluation, an
ELContext object is not thread-safe. Care should be taken
to never share an ELContext instance between two or more
threads.
ELContextListener, ELContextEvent, ELResolver, FunctionMapper, VariableMapper, ImportHandler, LambdaExpression, StandardELContext, javax.servlet.jsp.JspContext
| Modifier and Type | Field and Description |
|---|---|
| private ImportHandler | |
| private Stack | |
| private transient List | |
| private Locale | locale
Holds value of property locale. |
| private HashMap | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addEvaluationListener(EvaluationListener
The listener to be added. listener)Registers an evaluation listener to the ELContext. |
| public Object | convertToType(Object
The object to convert. obj, Class<?> The target type for the conversion. targetType)Converts an object to a specific type. |
| public void | enterLambdaScope(Map<String, Object>
The Lambda arguments map args)Installs a Lambda argument map, in preparation for the evaluation of a Lambda expression. |
| public void | |
| public Object | Returns: The context object associated with the given key, or null if no such context was found.The unique identifier that was used to associate the
context object with this key)ELContext.Returns the context object associated with the given key. |
| public abstract ELResolver | Returns: The resolver to be consulted for variable and property resolution during expression evaluation.Retrieves the |
| public List | Returns: The list of registered evaluation listeners.Returns the list of registered evaluation listeners. |
| public abstract FunctionMapper | Returns: The function mapper to be consulted for the resolution of EL functions.Retrieves the |
| public ImportHandler | Returns: The import handler to manage imports of classes and packages.Retrieves the |
| public Object | Returns: The object associated with formal parameter. Null if no object has been associated with the parameter.The formal parameter for the Lambda argument arg)Retrieves the Lambda argument associated with a formal parameter. |
| public Locale | |
| public abstract VariableMapper | Returns: The variable mapper to be consulted for the resolution of EL variables.Retrieves the |
| public boolean | Returns: true if arg is a LambdaArgument, false otherwise.A possible Lambda formal parameter name arg)Inquires if the name is a LambdaArgument |
| public boolean | Returns: true if the property has been resolved, or false if not.Returns whether an |
| public void | notifyAfterEvaluation(String
The EL expression string that has been evaluated expr)Notifies the listeners after an EL expression is evaluated |
| public void | notifyBeforeEvaluation(String
The EL expression string to be evaluated expr)Notifies the listeners before an EL expression is evaluated |
| public void | notifyPropertyResolved(Object
The base object base, Object The property Object property)Notifies the listeners when the (base, property) pair is resolved |
| public void | putContext(Class<T>
The key used by an @{link ELResolver} to identify this
context object. key, Object The context object to add to the collection. contextObject)Associates a context object with this |
| public void | |
| public void | setPropertyResolved(boolean
true if the property has been resolved, or false if
not. resolved)Called to indicate that a |
| public void | setPropertyResolved(Object
The base object base, Object The property object property)Called to indicate that a |
| importHandler | back to summary |
|---|---|
| private ImportHandler importHandler | |
| lambdaArgs | back to summary |
|---|---|
| private Stack<Map<String, Object>> lambdaArgs | |
| listeners | back to summary |
|---|---|
| private transient List<EvaluationListener> listeners | |
| locale | back to summary |
|---|---|
| private Locale locale Holds value of property locale. | |
| map | back to summary |
|---|---|
| private HashMap<Class<?>, Object> map | |
| resolved | back to summary |
|---|---|
| private boolean resolved | |
| ELContext | back to summary |
|---|---|
| public ELContext() | |
| addEvaluationListener | back to summary |
|---|---|
| public void addEvaluationListener(EvaluationListener listener) Registers an evaluation listener to the ELContext.
| |
| convertToType | back to summary |
|---|---|
| public Object convertToType(Object obj, Class<?> targetType) Converts an object to a specific type. If a custom converter in the
An
| |
| enterLambdaScope | back to summary |
|---|---|
| public void enterLambdaScope(Map<String, Object> args) Installs a Lambda argument map, in preparation for the evaluation of a Lambda expression. The arguments in the map will be in scope during the evaluation of the Lambda expression. | |
| exitLambdaScope | back to summary |
|---|---|
| public void exitLambdaScope() Exits the Lambda expression evaluation. The Lambda argument map that was previously installed is removed.
| |
| getContext | back to summary |
|---|---|
| public Object getContext(Class<T> key) Returns the context object associated with the given key. The By convention, the object returned will be of the type specified by
the
| |
| getELResolver | back to summary |
|---|---|
| public abstract ELResolver getELResolver() Retrieves the The Once an
| |
| getEvaluationListeners | back to summary |
|---|---|
| public List Returns the list of registered evaluation listeners.
| |
| getFunctionMapper | back to summary |
|---|---|
| public abstract FunctionMapper getFunctionMapper() Retrieves the
| |
| getImportHandler | back to summary |
|---|---|
| public ImportHandler getImportHandler() Retrieves the
| |
| getLambdaArgument | back to summary |
|---|---|
| public Object getLambdaArgument(String arg) Retrieves the Lambda argument associated with a formal parameter. If the Lambda expression is nested within other Lambda expressions, the arguments for the current Lambda expression is first searched, and if not found, the arguments for the immediate nesting Lambda expression then searched, and so on. | |
| getLocale | back to summary |
|---|---|
| public Locale getLocale() Get the
| |
| getVariableMapper | back to summary |
|---|---|
| public abstract VariableMapper getVariableMapper() Retrieves the
| |
| isLambdaArgument | back to summary |
|---|---|
| public boolean isLambdaArgument(String arg) Inquires if the name is a LambdaArgument
| |
| isPropertyResolved | back to summary |
|---|---|
| public boolean isPropertyResolved() Returns whether an The
| |
| notifyAfterEvaluation | back to summary |
|---|---|
| public void notifyAfterEvaluation(String expr) Notifies the listeners after an EL expression is evaluated
| |
| notifyBeforeEvaluation | back to summary |
|---|---|
| public void notifyBeforeEvaluation(String expr) Notifies the listeners before an EL expression is evaluated
| |
| notifyPropertyResolved | back to summary |
|---|---|
| public void notifyPropertyResolved(Object base, Object property) Notifies the listeners when the (base, property) pair is resolved | |
| putContext | back to summary |
|---|---|
| public void putContext(Class<T> key, Object contextObject) Associates a context object with this The By convention, the
| |
| setLocale | back to summary |
|---|---|
| public void setLocale(Locale locale) Sets the | |
| setPropertyResolved | back to summary |
|---|---|
| public void setPropertyResolved(boolean resolved) Called to indicate that a The
| |
| setPropertyResolved | back to summary |
|---|---|
| public void setPropertyResolved(Object base, Object property) Called to indicate that a The
| |