private static class SymbolResolver.TestResolver extends SymbolResolver
SymbolResolver
for simple
testing and debug purposes.Modifier and Type | Class and Description |
---|---|
class |
SymbolResolver.TestResolver.Library |
Modifier and Type | Field and Description |
---|---|
private java.lang.Object |
testLib |
private Scope |
testScope |
_aastore, _aconst_null, _aload_0, _aload_1, _aload_2, _aload_3, _anewarray, _areturn, _astore_1, _astore_2, _astore_3, _checkcast, _d2i, _d2l, _dadd, _dcmpg, _dconst_0, _dconst_1, _ddiv, _dmul, _dneg, _drem, _dreturn, _dsub, _dup, _getfield, _goto, _i2d, _i2l, _iadd, _iand, _iconst_0, _iconst_1, _iconst_2, _iconst_3, _iconst_4, _iconst_5, _idiv, _if_icmpeq, _if_icmpge, _if_icmpgt, _if_icmple, _if_icmplt, _if_icmpne, _ifeq, _ifge, _ifgt, _ifle, _iflt, _ifne, _ifnonnull, _ifnull, _imul, _ineg, _invokeinterface, _invokespecial, _invokestatic, _invokevirtual, _ior, _irem, _ireturn, _ishl, _ishr, _isub, _iushr, _ixor, _l2d, _l2i, _ladd, _land, _lcmp, _lconst_0, _lconst_1, _ldc_w, _ldc2_w, _ldiv, _lmul, _lneg, _lor, _lrem, _lshl, _lshr, _lsub, _lushr, _lxor, _new, _pop, _pop2, _return, _swap, CLASS_COMPILEDEXPRESSION, METHDESC_EXECUTE, METHNAME_EXECUTE, METHOD_INIT
Constructor and Description |
---|
TestResolver() |
Modifier and Type | Method and Description |
---|---|
boolean |
checkPermission(java.lang.Class target,
java.lang.reflect.Method method,
boolean registered)
Check whether a user expression has permission to invoke the specified
method on the specified target class.
|
Scope |
getCurrentScope()
This method should return the scope currently associated with the
symbol resolver.
|
java.lang.Object |
resolveConstant(java.lang.String qualifier,
java.lang.String symbol)
Overriding implementations of this method should resolve the specified
string constant to a literal object.
|
dropLibrary, dropVariable, dropVariablePool, dumpVariablePool, getCachedInstance, getLibraryTarget, getLibraryTarget, getTestResolver, getVariable, lockInstanceCache, putCachedInstance, registerLibrary, registerVariable, resetVariables, resolveFunction, resolveFunction, unlockInstanceCache
private Scope testScope
private java.lang.Object testLib
public java.lang.Object resolveConstant(java.lang.String qualifier, java.lang.String symbol)
SymbolResolver
A return of any other type will cause a parsing error.
This method is invoked once per expression, at the time the expression
is first parsed by the ExpressionParser
. It is invoked for a
string which is not enclosed in any quotation marks, which is
embedded within an expression.
resolveConstant
in class SymbolResolver
qualifier
- An optional qualifier for concrete implementations which must
support multiple namespaces. A qualifier is not mandatory for
constants, so this parameter may be null
.symbol
- The string constant to be resolved to a literal.symbol
, or
null
if the symbol is not recognized.public boolean checkPermission(java.lang.Class target, java.lang.reflect.Method method, boolean registered)
SymbolResolver
This method is called only while an expression is parsed, never during
expression execution. It may be called multiple times for the same
combination of target
and method
while
parsing a single expression, if a symbol representing that method
invocation is encountered multiple times in that expression.
If permission is denied with a return of false
, a
SecurityException
will be thrown during expression
parsing, and the expression will not be compiled or executed.
The default implementation of this method always returns
true
; this method must be overridden to implement a
stricter security policy.
checkPermission
in class SymbolResolver
target
- Class containing method
.method
- Method which would be invoked at expression execution time
if permission is granted.registered
- true
if the method is registered as part of a
function library; false
if the method
is one that is invoked explicitly on an object symbol within
a user expression.true
to grant permission; false
to
deny it. This determination is completely at the discretion
of the implementing class, based upon its required security
policy.public Scope getCurrentScope()
SymbolResolver
Scope
interface, but its implementation is completely up to the
concrete implementation of this class. This method is called at
the moment an expression is first executed, during parsing and
compilation.getCurrentScope
in class SymbolResolver