Class ELSandboxedResolution
java.lang.Object
io.micronaut.el.runtime.ELSandboxedResolution
The resolution of the properties of an expression parsed at runtime, under the
ELSandbox of its
context where the resolution reflects.
A chain of this module knows which of its resolvers read the members of a base object without reflection,
and consults the sandbox before and after the others only: see ELResolverChain.getValueSandboxed(ELContext, Object, Object). What
another resolver does cannot be told apart, so a context whose resolver is not such a chain is checked on
every property. An expression compiled at compilation time resolves through ELResolution and is never
checked.
- Since:
- 1.1
- Author:
- Denis Stepanov
-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable ObjectassignProperty(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object property, @Nullable Object value) Assigns a value to a property and returns the assigned value, asELResolution.assignProperty(ELContext, Object, Object, Object)does.static voidcheckAccess(ELSandbox sandbox, Object base) Fails when the sandbox denies the base object of a reflective access.static <T> @Nullable TcheckValue(ELSandbox sandbox, @Nullable T value) Fails when the value a reflective access produced is of a type the sandbox denies, so that reflection never hands an expression what it would not let the expression use.static @Nullable Class<?> static @Nullable ObjectResolves a property of a base object asELResolution.getValue(ELContext, Object, Object)does.static booleanisReadOnly(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object property) static @Nullable ObjectresolveIdentifier(jakarta.el.ELContext context, String name) Resolves an identifier asELResolution.resolveIdentifier(ELContext, String)does, reading the field of a static import under the sandbox.static @Nullable ObjectresolveValue(jakarta.el.ELContext context, Object base, @Nullable Object property) Resolves a property of a base object through the resolver of the context, leaving it topropertyResolvedto say whether a resolver resolved it.static voidsetValue(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object property, @Nullable Object value) Assigns a value to a property of a base object asELResolution.setValue(ELContext, Object, Object, Object)does.
-
Method Details
-
resolveIdentifier
Resolves an identifier asELResolution.resolveIdentifier(ELContext, String)does, reading the field of a static import under the sandbox.- Parameters:
context- The contextname- The identifier- Returns:
- The value of the identifier
-
getValue
public static @Nullable Object getValue(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object property) Resolves a property of a base object asELResolution.getValue(ELContext, Object, Object)does.- Parameters:
context- The contextbase- The base objectproperty- The property- Returns:
- The resolved value
-
resolveValue
public static @Nullable Object resolveValue(jakarta.el.ELContext context, Object base, @Nullable Object property) Resolves a property of a base object through the resolver of the context, leaving it topropertyResolvedto say whether a resolver resolved it. This is how a resolver that reads the property of a value it holds, as the resolver of anOptionaldoes, reaches that property without leaving the sandbox behind.- Parameters:
context- The contextbase- The base objectproperty- The property- Returns:
- The resolved value, when a resolver resolved it
-
setValue
public static void setValue(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object property, @Nullable Object value) Assigns a value to a property of a base object asELResolution.setValue(ELContext, Object, Object, Object)does.- Parameters:
context- The contextbase- The base objectproperty- The propertyvalue- The value to assign
-
assignProperty
public static @Nullable Object assignProperty(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object property, @Nullable Object value) Assigns a value to a property and returns the assigned value, asELResolution.assignProperty(ELContext, Object, Object, Object)does.- Parameters:
context- The contextbase- The base objectproperty- The propertyvalue- The value- Returns:
- The assigned value
-
getType
public static @Nullable Class<?> getType(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object property) - Parameters:
context- The contextbase- The base objectproperty- The property- Returns:
- The type of the property, as
ELResolution.getType(ELContext, Object, Object)resolves it
-
isReadOnly
public static boolean isReadOnly(jakarta.el.ELContext context, @Nullable Object base, @Nullable Object property) - Parameters:
context- The contextbase- The base objectproperty- The property- Returns:
- Whether the property is read only, as
ELResolution.isReadOnly(ELContext, Object, Object)resolves it
-
checkAccess
-
checkValue
Fails when the value a reflective access produced is of a type the sandbox denies, so that reflection never hands an expression what it would not let the expression use.- Type Parameters:
T- The type of the value- Parameters:
sandbox- The sandboxvalue- The value- Returns:
- The value
-