public final class This
extends java.lang.Object
implements java.io.Serializable, java.lang.Runnable
| Modifier and Type | Class and Description |
|---|---|
static class |
This.ConstructorArgs
A ConstructorArgs object holds evaluated arguments for a constructor
call as well as the index of a possible alternate selector to invoke.
|
| Modifier and Type | Field and Description |
|---|---|
static java.util.Map<java.lang.String,NameSpace> |
contextStore |
| Modifier and Type | Method and Description |
|---|---|
static void |
bind(This ths,
NameSpace namespace,
Interpreter declaringInterpreter)
Bind a This reference to a parent's namespace with the specified
declaring interpreter.
|
java.lang.Object[] |
enumValues()
Delegate method to return enum values array.
|
static This.ConstructorArgs |
getConstructorArgs(java.lang.Class<?> superClass,
This classStaticThis,
java.lang.Object[] consArgs,
int index)
This method is called by the **generated class** during construction.
|
java.lang.Object |
getInterface(java.lang.Class<?> clas)
Get dynamic proxy for interface, caching those it creates.
|
java.lang.Object |
getInterface(java.lang.Class<?>[] ca)
Get dynamic proxy for interface, caching those it creates.
|
NameSpace |
getNameSpace() |
static void |
initInstance(GeneratedClass instance,
java.lang.Class<?> genClass,
java.lang.Object[] args)
Initialize an instance of the class.
|
static void |
initStatic(java.lang.Class<?> genClass)
Lazy initialize static context implementation.
|
java.lang.Object |
invokeMethod(java.lang.String methodName,
java.lang.Class<?>[] paramTypes,
java.lang.Object[] args,
boolean declaredOnly)
Class generated method stub entry that selects the scripted method
by the stub's own parameter types rather than the argument values.
|
java.lang.Object |
invokeMethod(java.lang.String name,
java.lang.Object[] args)
Invoke specified method as from outside java code, using the
declaring interpreter and current namespace.
|
java.lang.Object |
invokeMethod(java.lang.String methodName,
java.lang.Object[] args,
boolean declaredOnly)
Simplified method for class generated method stubs.
|
java.lang.Object |
invokeMethod(java.lang.String methodName,
java.lang.Object[] args,
Interpreter interpreter,
CallStack callstack,
Node callerInfo,
boolean declaredOnly)
Invoke a method in this namespace with the specified args,
interpreter reference, callstack, and caller info.
|
static This |
pullBshStatic(java.lang.String uuid)
Pull provider for class static This.
|
void |
run() |
java.lang.String |
toString() |
public static final java.util.Map<java.lang.String,NameSpace> contextStore
public java.lang.Object getInterface(java.lang.Class<?> clas)
public java.lang.Object getInterface(java.lang.Class<?>[] ca)
public NameSpace getNameSpace()
public java.lang.String toString()
toString in class java.lang.Objectpublic void run()
run in interface java.lang.Runnablepublic java.lang.Object invokeMethod(java.lang.String name,
java.lang.Object[] args)
throws EvalError
public java.lang.Object invokeMethod(java.lang.String methodName,
java.lang.Object[] args,
boolean declaredOnly)
throws EvalError
EvalErrorpublic java.lang.Object invokeMethod(java.lang.String methodName,
java.lang.Class<?>[] paramTypes,
java.lang.Object[] args,
boolean declaredOnly)
throws EvalError
EvalErrorpublic java.lang.Object invokeMethod(java.lang.String methodName,
java.lang.Object[] args,
Interpreter interpreter,
CallStack callstack,
Node callerInfo,
boolean declaredOnly)
throws EvalError
Note: If you use this method outside of the bsh package and wish to use variables with primitive values you will have to wrap them using bsh.Primitive. Consider using This getInterface() to make a true Java interface for invoking your scripted methods.
This method also implements the default object protocol of toString(), hashCode() and equals() and the invoke() meta-method handling as a last resort.
Note: The invoke() meta-method will not catch the Object protocol methods (toString(), hashCode()...). If you want to override them you have to script them directly.
callstack - if callStack is null a new CallStack will be created and
initialized with this namespace.declaredOnly - if true then only methods declared directly in the
namespace will be visible - no inherited or imported methods will
be visible.EvalErrorinvokeMethod(String, Object[], Interpreter, CallStack, Node, boolean),
Primitivepublic java.lang.Object[] enumValues()
public static void bind(This ths, NameSpace namespace, Interpreter declaringInterpreter)
This is a static utility method because it's used by a bsh command bind() and the interpreter doesn't currently allow access to direct methods of This objects (small hack)
public static This.ConstructorArgs getConstructorArgs(java.lang.Class<?> superClass, This classStaticThis, java.lang.Object[] consArgs, int index)
consArgs - the arguments to the constructor. These are necessary in
the evaluation of the alt constructor args. e.g. Foo(a) { super(a); }public static void initInstance(GeneratedClass instance, java.lang.Class<?> genClass, java.lang.Object[] args)
public static void initStatic(java.lang.Class<?> genClass)
throws UtilEvalError
genClass - the generated class.className - name of the class.UtilEvalError - combined exceptions.public static This pullBshStatic(java.lang.String uuid)
uuid - the class unique id.