# Class JexlPermissions.Delegate

java.lang.Object
org.apache.commons.jexl3.introspection.JexlPermissions.Delegate

All Implemented Interfaces:
  `JexlPermissions`

Direct Known Subclasses:
  `JexlPermissions.ClassPermissions`

Enclosing interface:
  `JexlPermissions`

public static class JexlPermissions.Delegate extends Object implements JexlPermissions
A base for permission delegation allowing functional refinement. Overloads should call the appropriate validate() method early in their body.

Since:
  3.3

- ## Nested Class Summary

  ### Nested classes/interfaces inherited from interface JexlPermissions

  `JexlPermissions.ClassPermissions, JexlPermissions.Delegate`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final JexlPermissions`
  `base`
  The permissions we delegate to.

  ### Fields inherited from interface JexlPermissions

  `RESTRICTED, UNRESTRICTED`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `Delegate(JexlPermissions delegate)`
  Constructs a new instance.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `allow(Class<?> clazz)`
  Checks whether a class allows JEXL introspection.
  `boolean`
  `allow(Package pack)`
  Checks whether a package allows JEXL introspection.
  `boolean`
  `allow(Constructor<?> ctor)`
  Checks whether a constructor allows JEXL introspection.
  `boolean`
  `allow(Field field)`
  Checks whether a field explicitly disallows JEXL introspection.
  `boolean`
  `allow(Method method)`
  Checks whether a method allows JEXL introspection.
  `JexlPermissions`
  `compose(String... src)`
  Compose these permissions with a new set.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface JexlPermissions

  `validate, validate, validate, validate, validate`

- ## Field Details

  - ### base

    protected final JexlPermissions base
    The permissions we delegate to.

- ## Constructor Details

  - ### Delegate

    protected Delegate(JexlPermissions delegate)
    Constructs a new instance.
    Parameters:
      `delegate` - the delegate.

- ## Method Details

  - ### allow

    public boolean allow(Class<?> clazz)
    Description copied from interface: `JexlPermissions`
    Checks whether a class allows JEXL introspection.

    If the class disallows JEXL introspection, none of its constructors, methods or fields as well as derived classes are visible to JEXL and cannot be used in scripts or expressions. If one of its super-classes is not allowed, tbe class is not allowed either.

    For interfaces, only methods and fields are disallowed in derived interfaces or implementing classes.

    Specified by:
      `allow` in interface `JexlPermissions`
    Parameters:
      `clazz` - the class to check
    Returns:
      true if JEXL is allowed to introspect, false otherwise

  - ### allow

    public boolean allow(Constructor<?> ctor)
    Description copied from interface: `JexlPermissions`
    Checks whether a constructor allows JEXL introspection.

    If a constructor is not allowed, the new operator cannot be used to instantiate its declared class in scripts or expressions.

    Specified by:
      `allow` in interface `JexlPermissions`
    Parameters:
      `ctor` - the constructor to check
    Returns:
      true if JEXL is allowed to introspect, false otherwise

  - ### allow

    public boolean allow(Field field)
    Description copied from interface: `JexlPermissions`
    Checks whether a field explicitly disallows JEXL introspection.

    If a field is not allowed, it cannot resolved and accessed in scripts or expressions.

    Specified by:
      `allow` in interface `JexlPermissions`
    Parameters:
      `field` - the field to check
    Returns:
      true if JEXL is allowed to introspect, false otherwise

  - ### allow

    public boolean allow(Method method)
    Description copied from interface: `JexlPermissions`
    Checks whether a method allows JEXL introspection.

    If a method is not allowed, it cannot resolved and called in scripts or expressions.

    Since methods can be overridden and overloaded, this also checks that no superclass or interface explicitly disallows this methods.

    Specified by:
      `allow` in interface `JexlPermissions`
    Parameters:
      `method` - the method to check
    Returns:
      true if JEXL is allowed to introspect, false otherwise

  - ### allow

    public boolean allow(Package pack)
    Description copied from interface: `JexlPermissions`
    Checks whether a package allows JEXL introspection.

    If the package disallows JEXL introspection, none of its classes or interfaces are visible to JEXL and cannot be used in scripts or expression.

    Specified by:
      `allow` in interface `JexlPermissions`
    Parameters:
      `pack` - the package
    Returns:
      true if JEXL is allowed to introspect, false otherwise

  - ### compose

    public JexlPermissions compose(String... src)
    Description copied from interface: `JexlPermissions`
    Compose these permissions with a new set.

    This is a convenience method meant to easily give access to the packages JEXL is used to integrate with. For instance, using ``JexlPermissions.RESTRICTED`.compose("com.my.app.*")` would extend the restricted set of permissions by allowing the com.my.app package.

    Specified by:
      `compose` in interface `JexlPermissions`
    Parameters:
      `src` - the new constraints
    Returns:
      the new permissions