Class SandboxUberspect

  • All Implemented Interfaces:
    JexlUberspect

    public final class SandboxUberspect
    extends java.lang.Object
    implements JexlUberspect
    An uberspect that controls usage of properties, methods and constructors through a sandbox.
    Since:
    3.0
    • Field Detail

      • uberspect

        private final JexlUberspect uberspect
        The base uberspect.
      • sandbox

        private final JexlSandbox sandbox
        The sandbox.
    • Constructor Detail

      • SandboxUberspect

        public SandboxUberspect​(JexlUberspect theUberspect,
                                JexlSandbox theSandbox)
        A constructor for JexlSandbox uberspect.
        Parameters:
        theUberspect - the JexlUberspect to sandbox
        theSandbox - the sandbox which is copied to avoid changes at runtime
    • Method Detail

      • eq

        private static boolean eq​(java.lang.Object lhs,
                                  java.lang.Object rhs)
        Identity equality.

        Spotbugs just hates string identity...

        Parameters:
        lhs - left hand side
        rhs - right hand side
        Returns:
        true if left is identical to right
      • getArithmetic

        public JexlArithmetic.Uberspect getArithmetic​(JexlArithmetic arithmetic)
        Description copied from interface: JexlUberspect
        Gets an arithmetic operator resolver for a given arithmetic instance.
        Specified by:
        getArithmetic in interface JexlUberspect
        Parameters:
        arithmetic - the arithmetic instance
        Returns:
        the arithmetic uberspect or null if no operator method were overridden
      • getClassByName

        public java.lang.Class<?> getClassByName​(java.lang.String className)
        Description copied from interface: JexlUberspect
        Seeks a class by name using this uberspect class-loader.
        Specified by:
        getClassByName in interface JexlUberspect
        Parameters:
        className - the class name
        Returns:
        the class instance or null if the class cannot be located by this uberspect class loader or if permissions deny access to the class
      • getClassLoader

        public java.lang.ClassLoader getClassLoader()
        Description copied from interface: JexlUberspect
        Gets the current class loader.
        Specified by:
        getClassLoader in interface JexlUberspect
        Returns:
        the class loader
      • getConstructor

        public JexlMethod getConstructor​(java.lang.Object ctorHandle,
                                         java.lang.Object... args)
        Description copied from interface: JexlUberspect
        Returns a class constructor.
        Specified by:
        getConstructor in interface JexlUberspect
        Parameters:
        ctorHandle - a class or class name
        args - constructor arguments
        Returns:
        a JexlMethod
      • getIterator

        public java.util.Iterator<?> getIterator​(java.lang.Object obj)
        Description copied from interface: JexlUberspect
        Gets an iterator from an object.
        Specified by:
        getIterator in interface JexlUberspect
        Parameters:
        obj - to get the iterator from
        Returns:
        an iterator over obj or null
      • getMethod

        public JexlMethod getMethod​(java.lang.Object obj,
                                    java.lang.String method,
                                    java.lang.Object... args)
        Description copied from interface: JexlUberspect
        Returns a JexlMethod.
        Specified by:
        getMethod in interface JexlUberspect
        Parameters:
        obj - the object
        method - the method name
        args - method arguments
        Returns:
        a JexlMethod
      • getPropertyGet

        public JexlPropertyGet getPropertyGet​(java.lang.Object obj,
                                              java.lang.Object identifier)
        Description copied from interface: JexlUberspect
        Property getter.

        returns a JelPropertySet apropos to an expression like bar.woogie.

        Specified by:
        getPropertyGet in interface JexlUberspect
        Parameters:
        obj - the object to get the property from
        identifier - property name
        Returns:
        a JexlPropertyGet or null
      • getPropertySet

        public JexlPropertySet getPropertySet​(java.lang.Object obj,
                                              java.lang.Object identifier,
                                              java.lang.Object arg)
        Description copied from interface: JexlUberspect
        Property setter.

        Seeks a JelPropertySet apropos to an expression like foo.bar = "geir".

        Specified by:
        getPropertySet in interface JexlUberspect
        Parameters:
        obj - the object to get the property from.
        identifier - property name
        arg - value to set
        Returns:
        a JexlPropertySet or null
      • getVersion

        public int getVersion()
        Description copied from interface: JexlUberspect
        Gets this uberspect version.
        Specified by:
        getVersion in interface JexlUberspect
        Returns:
        the class loader modification count
      • setClassLoader

        public void setClassLoader​(java.lang.ClassLoader loader)
        Description copied from interface: JexlUberspect
        Sets the class loader to use.

        This increments the version.

        Specified by:
        setClassLoader in interface JexlUberspect
        Parameters:
        loader - the class loader