ELResolvers.
Though only a single ELResolver is associated with an ELContext, there are usually multiple
resolvers considered for any given variable or property resolution. ELResolvers are combined together
using a CompositeELResolver, to define rich semantics for evaluating an expression.
For the getValue, getType, setValue and isReadOnly methods, an
ELResolver is not responsible for resolving all possible (base, property) pairs. In fact, most resolvers
will only handle a base of a single type. To indicate that a resolver has successfully resolved a
particular (base, property) pair, it must set the propertyResolved property of the
ELContext to true. If it could not handle the given pair, it must leave this property
alone. The caller must ignore the return value of the method if propertyResolved is false.
The CompositeELResolver initializes the ELContext.propertyResolved flag to
false, and uses it as a stop condition for iterating through its component resolvers.
The ELContext.propertyResolved flag is not used for the design-time method
getCommonPropertyType. Instead, results are collected and combined from
all child ELResolvers for this method.
ELContext, ELResolver
| Modifier and Type | Field and Description |
|---|---|
| private ELResolver[] | |
| private int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | add(ELResolver
The component resolver to add. elResolver)Adds the given resolver to the list of component resolvers. |
| public <T> T | convertToType(ELContext
The context of this evaluation. context, Object The object to convert. obj, Class<T> The target type for the convertion. targetType)Overrides jakarta. Converts an object to a specific type. |
| public Class | Returns: null if this ELResolver does not know how to handle the given base
object; otherwise Object.class if any type of property is accepted; otherwise the most
general property type accepted for the given base.The context of this evaluation. context, Object The base object to return the most general property type for, or base)null to enumerate the set
of top-level variables that this resolver can evaluate.Implements abstract jakarta. Returns the most general type that this resolver accepts for the |
| public Class | Returns: If thepropertyResolved property of ELContext was set to true, then
the most general acceptable type which must be null if the either the property or the resolver is
read-only; otherwise undefinedThe context of this evaluation. context, Object The base object whose property value is to be analyzed, or base, Object null to analyze a top-level
variable.The property or variable to return the acceptable type for. property)Implements abstract jakarta. For a given |
| public Object | Returns: If thepropertyResolved property of ELContext was set to true, then
the result of the variable or property resolution; otherwise undefined.The context of this evaluation. context, Object The base object whose property value is to be returned, or base, Object null to resolve a top-level
variable.The property or variable to be resolved. property)Implements abstract jakarta. Attempts to resolve the given |
| public Object | Returns: The result of the method invocation (null if the method has a void return type).The context of this evaluation. context, Object The bean on which to invoke the method base, Object The simple name of the method to invoke. Will be coerced to a method, Class<?>[] String.An array of Class objects identifying the method's formal parameter types, in declared order. Use
an empty array if the method has no parameters. Can be paramTypes, Object[] null, in which case the method's formal parameter
types are assumed to be unknown.The parameters to pass to the method, or params)null if no parameters.Overrides jakarta. Attempts to resolve and invoke the given |
| public boolean | Returns: If thepropertyResolved property of ELContext was set to true, then
true if the property is read-only or false if not; otherwise undefined.The context of this evaluation. context, Object The base object whose property value is to be analyzed, or base, Object null to analyze a top-level
variable.The property or variable to return the read-only status for. property)Implements abstract jakarta. For a given |
| public void | setValue(ELContext
The context of this evaluation. context, Object The base object whose property value is to be set, or base, Object null to set a top-level variable.The property or variable to be set. property, Object The value to set the property or variable to. val)Implements abstract jakarta. Attempts to set the value of the given |
| elResolvers | back to summary |
|---|---|
| private ELResolver[] elResolvers | |
| size | back to summary |
|---|---|
| private int size | |
| CompositeELResolver | back to summary |
|---|---|
| public CompositeELResolver() | |
| add | back to summary |
|---|---|
| public void add(ELResolver elResolver) Adds the given resolver to the list of component resolvers. Resolvers are consulted in the order in which they are added.
| |
| convertToType | back to summary |
|---|---|
| public <T> T convertToType(ELContext context, Object obj, Class<T> targetType) Overrides jakarta. Converts an object to a specific type.
An
| |
| getCommonPropertyType | back to summary |
|---|---|
| public Class Implements abstract jakarta. Returns the most general type that this resolver accepts for the
The
| |
| getType | back to summary |
|---|---|
| public Class Implements abstract jakarta. For a given
If this resolver handles the given (base, property) pair, the
First, Next, for each component resolver in this composite:
If none of the component resolvers were able to perform this operation, the value Any exception thrown by component resolvers during the iteration is propagated to the caller of this method.
| |
| getValue | back to summary |
|---|---|
| public Object getValue(ELContext context, Object base, Object property) Implements abstract jakarta. Attempts to resolve the given
If this resolver handles the given (base, property) pair, the
First, Next, for each component resolver in this composite:
If none of the component resolvers were able to perform this operation, the value Any exception thrown by component resolvers during the iteration is propagated to the caller of this method.
| |
| invoke | back to summary |
|---|---|
| public Object invoke(ELContext context, Object base, Object method, Class<?>[] paramTypes, Object[] params) Overrides jakarta. Attempts to resolve and invoke the given
If this resolver handles the given (base, method) pair, the
First, Next, for each component resolver in this composite:
If none of the component resolvers were able to perform this operation, the value Any exception thrown by component resolvers during the iteration is propagated to the caller of this method.
| |
| isReadOnly | back to summary |
|---|---|
| public boolean isReadOnly(ELContext context, Object base, Object property) Implements abstract jakarta. For a given
If this resolver handles the given (base, property) pair, the
First, Next, for each component resolver in this composite:
If none of the component resolvers were able to perform this operation, the value Any exception thrown by component resolvers during the iteration is propagated to the caller of this method.
| |
| setValue | back to summary |
|---|---|
| public void setValue(ELContext context, Object base, Object property, Object val) Implements abstract jakarta. Attempts to set the value of the given
If this resolver handles the given (base, property) pair, the
First, Next, for each component resolver in this composite:
If none of the component resolvers were able to perform this operation, the Any exception thrown by component resolvers during the iteration is propagated to the caller of this method.
| |