Class ELResolverChain
java.lang.Object
jakarta.el.ELResolver
jakarta.el.CompositeELResolver
io.micronaut.el.resolver.ELResolverChain
public final class ELResolverChain
extends jakarta.el.CompositeELResolver
A
CompositeELResolver that only consults, for an operation a resolver does not have to implement,
the resolvers that implement it.
ELResolver.convertToType(ELContext, Object, Class) and ELResolver.invoke(ELContext, Object, Object, Class[], Object[]) have a default implementation that resolves
nothing, and none of the resolvers of the specification overrides the former. The composite of the
specification still asks every resolver on every coercion, which is the single largest cost of evaluating a
compiled expression: the result of every value expression is coerced to its expected type. This composite
records, when a resolver is added, whether its class overrides each of the two methods, and iterates only the
resolvers that do. The semantics are the ones of CompositeELResolver: the resolvers are consulted in
order until one sets propertyResolved.
- Since:
- 1.0
- Author:
- Denis Stepanov
-
Constructor Summary
ConstructorsConstructorDescriptionELResolverChain(jakarta.el.ELResolver... resolvers) Creates a chain of the given resolvers, in order.ELResolverChain(List<? extends jakarta.el.ELResolver> resolvers) Creates a chain of the given resolvers, in order. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(jakarta.el.ELResolver elResolver) booleanconverts()<T> @Nullable TconvertToType(jakarta.el.ELContext context, @Nullable Object obj, @Nullable Class<T> targetType) @Nullable Class<?> getTypeSandboxed(jakarta.el.ELContext context, Object base, @Nullable Object property) Resolves the type of a property of a base object for an expression parsed at runtime, consulting theELSandboxof the context about the base object asgetValueSandboxed(ELContext, Object, Object)does.@Nullable Object@Nullable ObjectgetValueSandboxed(jakarta.el.ELContext context, Object base, @Nullable Object property) Resolves a property of a base object for an expression parsed at runtime.@Nullable Objectinvoke(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object method, Class<?> @Nullable [] paramTypes, @Nullable Object[] params) booleanisReadOnlySandboxed(jakarta.el.ELContext context, Object base, @Nullable Object property) Resolves whether a property of a base object is read only for an expression parsed at runtime, consulting theELSandboxof the context about the base object asgetValueSandboxed(ELContext, Object, Object)does.voidsetValueSandboxed(jakarta.el.ELContext context, Object base, @Nullable Object property, @Nullable Object value) Assigns a property of a base object for an expression parsed at runtime, consulting theELSandboxof the context about the base object asgetValueSandboxed(ELContext, Object, Object)does.Methods inherited from class jakarta.el.CompositeELResolver
getCommonPropertyType, getType, isReadOnly, setValue
-
Constructor Details
-
ELResolverChain
public ELResolverChain(jakarta.el.ELResolver... resolvers) Creates a chain of the given resolvers, in order.- Parameters:
resolvers- The resolvers
-
ELResolverChain
Creates a chain of the given resolvers, in order.- Parameters:
resolvers- The resolvers
-
-
Method Details
-
add
public void add(jakarta.el.ELResolver elResolver) - Overrides:
addin classjakarta.el.CompositeELResolver
-
converts
public boolean converts()- Returns:
- Whether any of the resolvers implements
ELResolver.convertToType(ELContext, Object, Class)
-
getValue
-
getValueSandboxed
@Internal public @Nullable Object getValueSandboxed(jakarta.el.ELContext context, Object base, @Nullable Object property) Resolves a property of a base object for an expression parsed at runtime. The resolvers are consulted asgetValue(ELContext, Object, Object)consults them, and theELSandboxof the context is asked about the base object before the first resolver that is not known to read it without reflection, and about the value such a resolver produced. The resolvers known to read without reflection are not held up by the sandbox at all.- Parameters:
context- The contextbase- The base objectproperty- The property- Returns:
- The value, when a resolver resolved it
-
setValueSandboxed
@Internal public void setValueSandboxed(jakarta.el.ELContext context, Object base, @Nullable Object property, @Nullable Object value) Assigns a property of a base object for an expression parsed at runtime, consulting theELSandboxof the context about the base object asgetValueSandboxed(ELContext, Object, Object)does.- Parameters:
context- The contextbase- The base objectproperty- The propertyvalue- The value
-
getTypeSandboxed
@Internal public @Nullable Class<?> getTypeSandboxed(jakarta.el.ELContext context, Object base, @Nullable Object property) Resolves the type of a property of a base object for an expression parsed at runtime, consulting theELSandboxof the context about the base object asgetValueSandboxed(ELContext, Object, Object)does. The type is not a value the property holds, so it is not checked.- Parameters:
context- The contextbase- The base objectproperty- The property- Returns:
- The type, when a resolver resolved it
-
isReadOnlySandboxed
@Internal public boolean isReadOnlySandboxed(jakarta.el.ELContext context, Object base, @Nullable Object property) Resolves whether a property of a base object is read only for an expression parsed at runtime, consulting theELSandboxof the context about the base object asgetValueSandboxed(ELContext, Object, Object)does.- Parameters:
context- The contextbase- The base objectproperty- The property- Returns:
- Whether the property is read only, when a resolver resolved it
-
convertToType
-
invoke
-