Class ELSandboxedResolution

java.lang.Object
io.micronaut.el.runtime.ELSandboxedResolution

@Internal public final class ELSandboxedResolution extends Object
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 Details

    • resolveIdentifier

      public static @Nullable Object resolveIdentifier(jakarta.el.ELContext context, String name)
      Resolves an identifier as ELResolution.resolveIdentifier(ELContext, String) does, reading the field of a static import under the sandbox.
      Parameters:
      context - The context
      name - 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 as ELResolution.getValue(ELContext, Object, Object) does.
      Parameters:
      context - The context
      base - The base object
      property - 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 to propertyResolved to say whether a resolver resolved it. This is how a resolver that reads the property of a value it holds, as the resolver of an Optional does, reaches that property without leaving the sandbox behind.
      Parameters:
      context - The context
      base - The base object
      property - 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 as ELResolution.setValue(ELContext, Object, Object, Object) does.
      Parameters:
      context - The context
      base - The base object
      property - The property
      value - 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, as ELResolution.assignProperty(ELContext, Object, Object, Object) does.
      Parameters:
      context - The context
      base - The base object
      property - The property
      value - 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 context
      base - The base object
      property - 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 context
      base - The base object
      property - The property
      Returns:
      Whether the property is read only, as ELResolution.isReadOnly(ELContext, Object, Object) resolves it
    • checkAccess

      public static void checkAccess(ELSandbox sandbox, Object base)
      Fails when the sandbox denies the base object of a reflective access.
      Parameters:
      sandbox - The sandbox
      base - The base object, an ELClass for a static member
    • checkValue

      public static <T> @Nullable T checkValue(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.
      Type Parameters:
      T - The type of the value
      Parameters:
      sandbox - The sandbox
      value - The value
      Returns:
      The value