Package jakarta.el
Class ELContext
- java.lang.Object
-
- jakarta.el.ELContext
-
- Direct Known Subclasses:
StandardELContext
public abstract class ELContext extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description ELContext()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addEvaluationListener(EvaluationListener listener)
Register an EvaluationListener with this ELContext.java.lang.Object
convertToType(java.lang.Object obj, java.lang.Class<?> type)
Coerce the supplied object to the requested type.void
enterLambdaScope(java.util.Map<java.lang.String,java.lang.Object> arguments)
Called when starting to evaluate a lambda expression so that the arguments are available to the EL context during evaluation.void
exitLambdaScope()
Called after evaluating a lambda expression to signal that the arguments are no longer required.java.lang.Object
getContext(java.lang.Class<?> key)
Obtain the context object for the given key.abstract ELResolver
getELResolver()
java.util.List<EvaluationListener>
getEvaluationListeners()
Obtain the list of registered EvaluationListeners.abstract FunctionMapper
getFunctionMapper()
ImportHandler
getImportHandler()
Obtain the ImportHandler for this ELContext, creating one if necessary.java.lang.Object
getLambdaArgument(java.lang.String name)
Obtain the value of the lambda argument with the given name.java.util.Locale
getLocale()
abstract VariableMapper
getVariableMapper()
boolean
isLambdaArgument(java.lang.String name)
Determine if the specified name is recognised as the name of a lambda argument.boolean
isPropertyResolved()
void
notifyAfterEvaluation(java.lang.String expression)
Notify interested listeners that an expression has been evaluated.void
notifyBeforeEvaluation(java.lang.String expression)
Notify interested listeners that an expression will be evaluated.void
notifyPropertyResolved(java.lang.Object base, java.lang.Object property)
Notify interested listeners that a property has been resolved.void
putContext(java.lang.Class<?> key, java.lang.Object contextObject)
Add an object to this EL context under the given key.void
setLocale(java.util.Locale locale)
void
setPropertyResolved(boolean resolved)
void
setPropertyResolved(java.lang.Object base, java.lang.Object property)
Mark the given property as resolved and notify any interested listeners.
-
-
-
Method Detail
-
setPropertyResolved
public void setPropertyResolved(boolean resolved)
-
setPropertyResolved
public void setPropertyResolved(java.lang.Object base, java.lang.Object property)
Mark the given property as resolved and notify any interested listeners.- Parameters:
base
- The base object on which the property was foundproperty
- The property that was resolved- Since:
- EL 3.0
-
isPropertyResolved
public boolean isPropertyResolved()
-
putContext
public void putContext(java.lang.Class<?> key, java.lang.Object contextObject)
Add an object to this EL context under the given key.- Parameters:
key
- The key under which to store the objectcontextObject
- The object to add- Throws:
java.lang.NullPointerException
- If the supplied key or context isnull
-
getContext
public java.lang.Object getContext(java.lang.Class<?> key)
Obtain the context object for the given key.- Parameters:
key
- The key of the required context object- Returns:
- The value of the context object associated with the given key
- Throws:
java.lang.NullPointerException
- If the supplied key isnull
-
getELResolver
public abstract ELResolver getELResolver()
-
getImportHandler
public ImportHandler getImportHandler()
Obtain the ImportHandler for this ELContext, creating one if necessary. This method is not thread-safe.- Returns:
- the ImportHandler for this ELContext.
- Since:
- EL 3.0
-
getFunctionMapper
public abstract FunctionMapper getFunctionMapper()
-
getLocale
public java.util.Locale getLocale()
-
setLocale
public void setLocale(java.util.Locale locale)
-
getVariableMapper
public abstract VariableMapper getVariableMapper()
-
addEvaluationListener
public void addEvaluationListener(EvaluationListener listener)
Register an EvaluationListener with this ELContext.- Parameters:
listener
- The EvaluationListener to register- Since:
- EL 3.0
-
getEvaluationListeners
public java.util.List<EvaluationListener> getEvaluationListeners()
Obtain the list of registered EvaluationListeners.- Returns:
- A list of the EvaluationListener registered with this ELContext
- Since:
- EL 3.0
-
notifyBeforeEvaluation
public void notifyBeforeEvaluation(java.lang.String expression)
Notify interested listeners that an expression will be evaluated.- Parameters:
expression
- The expression that will be evaluated- Since:
- EL 3.0
-
notifyAfterEvaluation
public void notifyAfterEvaluation(java.lang.String expression)
Notify interested listeners that an expression has been evaluated.- Parameters:
expression
- The expression that was evaluated- Since:
- EL 3.0
-
notifyPropertyResolved
public void notifyPropertyResolved(java.lang.Object base, java.lang.Object property)
Notify interested listeners that a property has been resolved.- Parameters:
base
- The object on which the property was resolvedproperty
- The property that was resolved- Since:
- EL 3.0
-
isLambdaArgument
public boolean isLambdaArgument(java.lang.String name)
Determine if the specified name is recognised as the name of a lambda argument.- Parameters:
name
- The name of the lambda argument- Returns:
true
if the name is recognised as the name of a lambda argument, otherwisefalse
- Since:
- EL 3.0
-
getLambdaArgument
public java.lang.Object getLambdaArgument(java.lang.String name)
Obtain the value of the lambda argument with the given name.- Parameters:
name
- The name of the lambda argument- Returns:
- The value of the specified argument
- Since:
- EL 3.0
-
enterLambdaScope
public void enterLambdaScope(java.util.Map<java.lang.String,java.lang.Object> arguments)
Called when starting to evaluate a lambda expression so that the arguments are available to the EL context during evaluation.- Parameters:
arguments
- The arguments in scope for the current lambda expression.- Since:
- EL 3.0
-
exitLambdaScope
public void exitLambdaScope()
Called after evaluating a lambda expression to signal that the arguments are no longer required.- Since:
- EL 3.0
-
convertToType
public java.lang.Object convertToType(java.lang.Object obj, java.lang.Class<?> type)
Coerce the supplied object to the requested type.- Parameters:
obj
- The object to be coercedtype
- The type to which the object should be coerced- Returns:
- An instance of the requested type.
- Throws:
ELException
- If the conversion fails- Since:
- EL 3.0
-
-