Class SandboxUberspect
java.lang.Object
org.apache.commons.jexl3.internal.introspection.SandboxUberspect
- All Implemented Interfaces:
JexlUberspect
An uberspect that controls usage of properties, methods and constructors through a sandbox.
- Since:
- 3.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.commons.jexl3.introspection.JexlUberspect
JexlUberspect.JexlResolver, JexlUberspect.PropertyResolver, JexlUberspect.ResolverStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final JexlSandbox
The sandbox.private final JexlUberspect
The base uberspect.Fields inherited from interface org.apache.commons.jexl3.introspection.JexlUberspect
JEXL_STRATEGY, MAP, MAP_STRATEGY, POJO
-
Constructor Summary
ConstructorsConstructorDescriptionSandboxUberspect
(JexlUberspect theUberspect, JexlSandbox theSandbox) A constructor for JexlSandbox uberspect. -
Method Summary
Modifier and TypeMethodDescriptionprivate static boolean
Identity equality.getArithmetic
(JexlArithmetic arithmetic) Gets an arithmetic operator resolver for a given arithmetic instance.Class
<?> getClassByName
(String className) Seeks a class by name using this uberspect class-loader.Gets the current class loader.getConstructor
(Object ctorHandle, Object... args) Returns a class constructor.Iterator
<?> getIterator
(Object obj) Gets an iterator from an object.Returns a JexlMethod.getPropertyGet
(Object obj, Object identifier) Property getter.getPropertyGet
(List<JexlUberspect.PropertyResolver> resolvers, Object obj, Object identifier) Property getter.getPropertySet
(Object obj, Object identifier, Object arg) Property setter.getPropertySet
(List<JexlUberspect.PropertyResolver> resolvers, Object obj, Object identifier, Object arg) Property setter.getResolvers
(JexlOperator op, Object obj) Applies this uberspect property resolver strategy.int
Gets this uberspect version.void
setClassLoader
(ClassLoader loader) Sets the class loader to use.
-
Field Details
-
uberspect
The base uberspect. -
sandbox
The sandbox.
-
-
Constructor Details
-
SandboxUberspect
A constructor for JexlSandbox uberspect.- Parameters:
theUberspect
- the JexlUberspect to sandboxtheSandbox
- the sandbox which is copied to avoid changes at runtime
-
-
Method Details
-
eq
Identity equality.Spotbugs just hates string identity...
- Parameters:
lhs
- left hand siderhs
- right hand side- Returns:
- true if left is identical to right
-
getArithmetic
Description copied from interface:JexlUberspect
Gets an arithmetic operator resolver for a given arithmetic instance.- Specified by:
getArithmetic
in interfaceJexlUberspect
- Parameters:
arithmetic
- the arithmetic instance- Returns:
- the arithmetic uberspect or null if no operator method were overridden
-
getClassByName
Description copied from interface:JexlUberspect
Seeks a class by name using this uberspect class-loader.- Specified by:
getClassByName
in interfaceJexlUberspect
- 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
Description copied from interface:JexlUberspect
Gets the current class loader.- Specified by:
getClassLoader
in interfaceJexlUberspect
- Returns:
- the class loader
-
getConstructor
Description copied from interface:JexlUberspect
Returns a class constructor.- Specified by:
getConstructor
in interfaceJexlUberspect
- Parameters:
ctorHandle
- a class or class nameargs
- constructor arguments- Returns:
- a
JexlMethod
-
getIterator
Description copied from interface:JexlUberspect
Gets an iterator from an object.- Specified by:
getIterator
in interfaceJexlUberspect
- Parameters:
obj
- to get the iterator from- Returns:
- an iterator over obj or null
-
getMethod
Description copied from interface:JexlUberspect
Returns a JexlMethod.- Specified by:
getMethod
in interfaceJexlUberspect
- Parameters:
obj
- the objectmethod
- the method nameargs
- method arguments- Returns:
- a
JexlMethod
-
getPropertyGet
public JexlPropertyGet getPropertyGet(List<JexlUberspect.PropertyResolver> resolvers, Object obj, Object identifier) Description copied from interface:JexlUberspect
Property getter.Seeks a JexlPropertyGet apropos to an expression like
Seebar.woogie
.JexlUberspect.ResolverStrategy.apply(JexlOperator, java.lang.Object)
- Specified by:
getPropertyGet
in interfaceJexlUberspect
- Parameters:
resolvers
- the list of property resolvers to tryobj
- the object to get the property fromidentifier
- property name- Returns:
- a
JexlPropertyGet
or null
-
getPropertyGet
Description copied from interface:JexlUberspect
Property getter.returns a JelPropertySet apropos to an expression like
bar.woogie
.- Specified by:
getPropertyGet
in interfaceJexlUberspect
- Parameters:
obj
- the object to get the property fromidentifier
- property name- Returns:
- a
JexlPropertyGet
or null
-
getPropertySet
public JexlPropertySet getPropertySet(List<JexlUberspect.PropertyResolver> resolvers, Object obj, Object identifier, Object arg) Description copied from interface:JexlUberspect
Property setter.Seeks a JelPropertySet apropos to an expression like
Seefoo.bar = "geir"
.JexlUberspect.ResolverStrategy.apply(JexlOperator, java.lang.Object)
- Specified by:
getPropertySet
in interfaceJexlUberspect
- Parameters:
resolvers
- the list of property resolvers to try,obj
- the object to get the property fromidentifier
- property namearg
- value to set- Returns:
- a
JexlPropertySet
or null
-
getPropertySet
Description copied from interface:JexlUberspect
Property setter.Seeks a JelPropertySet apropos to an expression like
foo.bar = "geir"
.- Specified by:
getPropertySet
in interfaceJexlUberspect
- Parameters:
obj
- the object to get the property from.identifier
- property namearg
- value to set- Returns:
- a
JexlPropertySet
or null
-
getResolvers
Description copied from interface:JexlUberspect
Applies this uberspect property resolver strategy.- Specified by:
getResolvers
in interfaceJexlUberspect
- Parameters:
op
- the operatorobj
- the object- Returns:
- the applied strategy resolver list
-
getVersion
public int getVersion()Description copied from interface:JexlUberspect
Gets this uberspect version.- Specified by:
getVersion
in interfaceJexlUberspect
- Returns:
- the class loader modification count
-
setClassLoader
Description copied from interface:JexlUberspect
Sets the class loader to use.This increments the version.
- Specified by:
setClassLoader
in interfaceJexlUberspect
- Parameters:
loader
- the class loader
-