bsh
Class BshMethod

java.lang.Object
  |
  +--bsh.BshMethod
All Implemented Interfaces:
java.io.Serializable

public class BshMethod
extends java.lang.Object
implements java.io.Serializable

This represents an *instance* of a bsh method declaration in a particular namespace. This is a thin wrapper around the BSHMethodDeclaration with a pointer to the declaring namespace.

The issue is that when a method is located in a subordinate namespace or invoked from an arbitrary namespace it must nontheless execute with its 'super' as the context in which it was declared. i.e. The local method context is a child namespace of the declaring namespace.

See Also:
Serialized Form

Field Summary
private  java.lang.Class[] argTypes
           
(package private)  NameSpace declaringNameSpace
           
(package private)  BSHMethodDeclaration method
           
 
Constructor Summary
(package private) BshMethod(BSHMethodDeclaration method, NameSpace declaringNameSpace)
           
 
Method Summary
 java.lang.Class[] getArgTypes()
          Note: bshmethod needs to re-evaluate arg types here This is broken
 java.lang.String getName()
           
 java.lang.Object invoke(java.lang.Object[] argValues, Interpreter interpreter, CallStack callstack)
          Invoke the declared method with the specified arguments, interpreter reference, and callstack.
(package private)  java.lang.Object invokeDeclaredMethod(java.lang.Object[] argValues, Interpreter interpreter, CallStack callstack, SimpleNode callerInfo)
          Invoke the bsh method with the specified args, interpreter ref, and callstack.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

method

BSHMethodDeclaration method

declaringNameSpace

NameSpace declaringNameSpace

argTypes

private java.lang.Class[] argTypes
Constructor Detail

BshMethod

BshMethod(BSHMethodDeclaration method,
          NameSpace declaringNameSpace)
Method Detail

getArgTypes

public java.lang.Class[] getArgTypes()
Note: bshmethod needs to re-evaluate arg types here This is broken


getName

public java.lang.String getName()

invoke

public java.lang.Object invoke(java.lang.Object[] argValues,
                               Interpreter interpreter,
                               CallStack callstack)
                        throws EvalError
Invoke the declared method with the specified arguments, interpreter reference, and callstack.

EvalError

invokeDeclaredMethod

java.lang.Object invokeDeclaredMethod(java.lang.Object[] argValues,
                                      Interpreter interpreter,
                                      CallStack callstack,
                                      SimpleNode callerInfo)
                                throws EvalError
Invoke the bsh method with the specified args, interpreter ref, and callstack. callerInfo is the node representing the method invocation It is used primarily for debugging in order to provide access to the text of the construct that invoked the method through the namespace.

Parameters:
callerInfo - is the node representing the method invocation This is used primarily for debugging and may be null.
callstack - is the callstack of course. If you are using a hacked version of BeanShell that exposed this method take a look at NameSpace invokeMethod to see how to make a fake callstack...
EvalError

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object