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 JexlSandboxThe sandbox.private final JexlUberspectThe 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 booleanIdentity 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.intGets this uberspect version.voidsetClassLoader(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:JexlUberspectGets an arithmetic operator resolver for a given arithmetic instance.- Specified by:
getArithmeticin interfaceJexlUberspect- Parameters:
arithmetic- the arithmetic instance- Returns:
- the arithmetic uberspect or null if no operator method were overridden
-
getClassByName
Description copied from interface:JexlUberspectSeeks a class by name using this uberspect class-loader.- Specified by:
getClassByNamein 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:JexlUberspectGets the current class loader.- Specified by:
getClassLoaderin interfaceJexlUberspect- Returns:
- the class loader
-
getConstructor
Description copied from interface:JexlUberspectReturns a class constructor.- Specified by:
getConstructorin interfaceJexlUberspect- Parameters:
ctorHandle- a class or class nameargs- constructor arguments- Returns:
- a
JexlMethod
-
getIterator
Description copied from interface:JexlUberspectGets an iterator from an object.- Specified by:
getIteratorin interfaceJexlUberspect- Parameters:
obj- to get the iterator from- Returns:
- an iterator over obj or null
-
getMethod
Description copied from interface:JexlUberspectReturns a JexlMethod.- Specified by:
getMethodin 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:JexlUberspectProperty getter.Seeks a JexlPropertyGet apropos to an expression like
Seebar.woogie.JexlUberspect.ResolverStrategy.apply(JexlOperator, java.lang.Object)- Specified by:
getPropertyGetin interfaceJexlUberspect- Parameters:
resolvers- the list of property resolvers to tryobj- the object to get the property fromidentifier- property name- Returns:
- a
JexlPropertyGetor null
-
getPropertyGet
Description copied from interface:JexlUberspectProperty getter.returns a JelPropertySet apropos to an expression like
bar.woogie.- Specified by:
getPropertyGetin interfaceJexlUberspect- Parameters:
obj- the object to get the property fromidentifier- property name- Returns:
- a
JexlPropertyGetor null
-
getPropertySet
public JexlPropertySet getPropertySet(List<JexlUberspect.PropertyResolver> resolvers, Object obj, Object identifier, Object arg) Description copied from interface:JexlUberspectProperty setter.Seeks a JelPropertySet apropos to an expression like
Seefoo.bar = "geir".JexlUberspect.ResolverStrategy.apply(JexlOperator, java.lang.Object)- Specified by:
getPropertySetin 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
JexlPropertySetor null
-
getPropertySet
Description copied from interface:JexlUberspectProperty setter.Seeks a JelPropertySet apropos to an expression like
foo.bar = "geir".- Specified by:
getPropertySetin interfaceJexlUberspect- Parameters:
obj- the object to get the property from.identifier- property namearg- value to set- Returns:
- a
JexlPropertySetor null
-
getResolvers
Description copied from interface:JexlUberspectApplies this uberspect property resolver strategy.- Specified by:
getResolversin interfaceJexlUberspect- Parameters:
op- the operatorobj- the object- Returns:
- the applied strategy resolver list
-
getVersion
public int getVersion()Description copied from interface:JexlUberspectGets this uberspect version.- Specified by:
getVersionin interfaceJexlUberspect- Returns:
- the class loader modification count
-
setClassLoader
Description copied from interface:JexlUberspectSets the class loader to use.This increments the version.
- Specified by:
setClassLoaderin interfaceJexlUberspect- Parameters:
loader- the class loader
-