Class SandboxUberspectImpl

  • All Implemented Interfaces:
    Uberspect

    public class SandboxUberspectImpl
    extends UberspectImpl
    An uberspect that controls usage of properties, methods and contructors through a sandbox.
    Since:
    2.1
    • Field Detail

      • sandbox

        protected final Sandbox sandbox
        The sandbox.
    • Constructor Detail

      • SandboxUberspectImpl

        public SandboxUberspectImpl​(org.apache.commons.logging.Log runtimeLogger,
                                    Sandbox theSandbox)
        A constructor for Sandbox uberspect.
        Parameters:
        runtimeLogger - the logger to use or null to use default
        theSandbox - the sandbox instance to use
    • Method Detail

      • setLoader

        public void setLoader​(java.lang.ClassLoader cloader)
        Resets this Uberspect class loader.
        Overrides:
        setLoader in class UberspectImpl
        Parameters:
        cloader - the class loader to use
      • getConstructorMethod

        public JexlMethod getConstructorMethod​(java.lang.Object ctorHandle,
                                               java.lang.Object[] args,
                                               JexlInfo info)
        Returns a class constructor wrapped in a JexlMethod.
        Specified by:
        getConstructorMethod in interface Uberspect
        Overrides:
        getConstructorMethod in class UberspectImpl
        Parameters:
        ctorHandle - a class or class name
        args - constructor arguments
        info - contextual information
        Returns:
        a Constructor
      • getMethod

        public JexlMethod getMethod​(java.lang.Object obj,
                                    java.lang.String method,
                                    java.lang.Object[] args,
                                    JexlInfo info)
        Returns a JexlMethod.
        Specified by:
        getMethod in interface Uberspect
        Overrides:
        getMethod in class UberspectImpl
        Parameters:
        obj - the object
        method - the method name
        args - method arguments
        info - contextual information
        Returns:
        a JexlMethod
      • getPropertyGet

        public JexlPropertyGet getPropertyGet​(java.lang.Object obj,
                                              java.lang.Object identifier,
                                              JexlInfo info)
        Property getter.

        Returns JexlPropertyGet appropos for ${bar.woogie}.

        Specified by:
        getPropertyGet in interface Uberspect
        Overrides:
        getPropertyGet in class UberspectImpl
        Parameters:
        obj - the object to get the property from
        identifier - property name
        info - contextual information
        Returns:
        a JexlPropertyGet
      • getPropertySet

        public JexlPropertySet getPropertySet​(java.lang.Object obj,
                                              java.lang.Object identifier,
                                              java.lang.Object arg,
                                              JexlInfo info)
        Property setter.

        returns JelPropertySet appropos for ${foo.bar = "geir"}

        .
        Specified by:
        getPropertySet in interface Uberspect
        Overrides:
        getPropertySet in class UberspectImpl
        Parameters:
        obj - the object to get the property from.
        identifier - property name
        arg - value to set
        info - contextual information
        Returns:
        a JexlPropertySet.