bsh
Class This

java.lang.Object
  extended bybsh.This
All Implemented Interfaces:
java.lang.Runnable, java.io.Serializable

public class This
extends java.lang.Object
implements java.io.Serializable, java.lang.Runnable

'This' is the type of bsh scripted objects. A 'This' object is a bsh scripted object context. It holds a namespace reference and implements event listeners and various other interfaces. This holds a reference to the declaring interpreter for callbacks from outside of bsh.

See Also:
Serialized Form

Constructor Summary
protected This(NameSpace namespace, Interpreter declaringInterpreter)
           
 
Method Summary
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 getInterface(java.lang.Class clas)
          Get a version of the interface.
 NameSpace getNameSpace()
           
 java.lang.Object invokeMethod(java.lang.String name, java.lang.Object[] args)
          Invoke specified method from outside java code, using the declaring interpreter and current namespace.
 java.lang.Object invokeMethod(java.lang.String name, java.lang.Object[] args, Interpreter interpreter, CallStack callstack, bsh.SimpleNode callerInfo)
          Invoke specified method with specified interpreter.
 void run()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

This

protected This(NameSpace namespace,
               Interpreter declaringInterpreter)
Method Detail

getInterface

public java.lang.Object getInterface(java.lang.Class clas)
                              throws EvalError
Get a version of the interface. If this type of This implements it directly return this, else try complain that we don't have the proxy mechanism.

Throws:
EvalError

getNameSpace

public NameSpace getNameSpace()

toString

public java.lang.String toString()

run

public void run()
Specified by:
run in interface java.lang.Runnable

invokeMethod

public java.lang.Object invokeMethod(java.lang.String name,
                                     java.lang.Object[] args)
                              throws EvalError
Invoke specified method from outside java code, using the declaring interpreter and current namespace. The call stack will appear as if the method is being invoked from outside of bsh in native java code.

Throws:
EvalError

invokeMethod

public java.lang.Object invokeMethod(java.lang.String name,
                                     java.lang.Object[] args,
                                     Interpreter interpreter,
                                     CallStack callstack,
                                     bsh.SimpleNode callerInfo)
                              throws EvalError
Invoke specified method with specified interpreter. This is simply a convenience method.

Throws:
EvalError

bind

public static void bind(This ths,
                        NameSpace namespace,
                        Interpreter declaringInterpreter)
Bind a This reference to a parent's namespace with the specified declaring interpreter. Also re-init the callstack. It's necessary to bind a This reference before it can be used after deserialization. This is used by the bsh load() command.

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)



© 2000 pat@pat.net :-)