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 methods
getFeatureDescriptors and getCommonPropertyType. Instead, results are collected and combined from
all child ELResolvers for these methods.
ELContext, ELResolver
| Modifier and Type | Class and Description |
|---|---|
| private static class | CompositeELResolver.CompositeIterator
Deprecated
for removal since 5.0. This method will be removed without replacement in EL 6.0
|
| 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. |
| 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. property argument, given a
base object.
|
| public Iterator | Returns: AnIterator containing zero or more (possibly infinitely more) FeatureDescriptor
objects, or null if this resolver does not handle the given base object or that the results
are too complex to represent with this methodThe context of this evaluation. context, Object The base object whose set of valid properties is to be enumerated, or base)null to enumerate the
set of top-level variables that this resolver can evaluate.Overrides jakarta.
Deprecated
for removal since 5.0. This method will be removed with replacement in EL 6.0
Returns information about the set of variables or properties that can be resolved for the given base
object.
|
| 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. base and property, attempts to identify the most general type that is
acceptable for an object to be passed as the value parameter in a future call to the setValue
method.
|
| 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. property object on the given base object by querying all
component resolvers.
|
| 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. method on the given base object by querying all
component resolvers.
|
| 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. base and property, attempts to determine whether a call to setValue
will always fail.
|
| 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. property object on the given base object.
|
| 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
| |
| getFeatureDescriptors | back to summary |
|---|---|
| public Iterator Overrides jakarta. Deprecated for removal since 5.0. This method will be removed with replacement in EL 6.0 Returns information about the set of variables or properties that can be resolved for the given
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.
| |
Deprecated
for removal since 5.0.
This method will be removed without replacement in EL 6.0
| Modifier and Type | Field and Description |
|---|---|
| pack-priv Object | |
| pack-priv ELContext | |
| pack-priv int | |
| pack-priv Iterator | |
| pack-priv ELResolver[] | |
| pack-priv int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public FeatureDescriptor | |
| public void | remove()
Overrides default java. |
| base | back to summary |
|---|---|
| pack-priv Object base | |
| context | back to summary |
|---|---|
| pack-priv ELContext context | |
| index | back to summary |
|---|---|
| pack-priv int index | |
| propertyIter | back to summary |
|---|---|
| pack-priv Iterator<FeatureDescriptor> propertyIter | |
| resolvers | back to summary |
|---|---|
| pack-priv ELResolver[] resolvers | |
| size | back to summary |
|---|---|
| pack-priv int size | |
| CompositeIterator | back to summary |
|---|---|
| pack-priv CompositeIterator(ELResolver[] resolvers, int size, ELContext context, Object base) | |
| hasNext | back to summary |
|---|---|
| public boolean hasNext() Implements java. Doc from java. Returns
| |
| next | back to summary |
|---|---|
| public FeatureDescriptor next() Implements java. Doc from java. Returns the next element in the iteration.
| |
| remove | back to summary |
|---|---|
| public void remove() Overrides default java. Doc from java. Removes from the underlying collection the last element returned
by this iterator (optional operation). This method can be called
only once per call to The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.
The behavior of an iterator is unspecified if this method is called
after a call to the
| |