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

Method Summary
 java.lang.Class[] getArgTypes()
          Deprecated. See #getArgumentTypes()
 java.lang.Class[] getArgumentTypes()
          Get the argument types of this method.
 java.lang.String getName()
           
 java.lang.Object getReturnType()
          Get the return type of the method.
 java.lang.Object invoke(java.lang.Object[] argValues, Interpreter interpreter)
          Invoke the declared method with the specified arguments and interpreter reference.
 java.lang.Object invoke(java.lang.Object[] argValues, Interpreter interpreter, CallStack callstack)
          Invoke the declared method with the specified arguments, interpreter reference, and callstack.
 java.lang.Object invoke(java.lang.Object[] argValues, Interpreter interpreter, CallStack callstack, bsh.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
 

Method Detail

getArgTypes

public java.lang.Class[] getArgTypes()
Deprecated. See #getArgumentTypes()


getArgumentTypes

public java.lang.Class[] getArgumentTypes()
Get the argument types of this method. loosely typed (untyped) arguments will be represented by null argument types.


getReturnType

public java.lang.Object getReturnType()
Get the return type of the method.

Returns:
Returns null for a loosely typed return value, Primitive.VOID for a void return type, or the Class of the type.

getName

public java.lang.String getName()

invoke

public java.lang.Object invoke(java.lang.Object[] argValues,
                               Interpreter interpreter)
                        throws EvalError
Invoke the declared method with the specified arguments and interpreter reference. This is the simplest form of invoke() for BshMethod intended to be used in reflective style access to bsh scripts.

EvalError

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.

Note: this form of invoke() uses a null Node for the caller and a null node for the CallStack. This method is for scripts performing relective style access to scripted methods.

EvalError

invoke

public java.lang.Object invoke(java.lang.Object[] argValues,
                               Interpreter interpreter,
                               CallStack callstack,
                               bsh.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 BeanShell AST node representing the method invocation. It is used to print the line number and text of errors in EvalError exceptions. If the node is null here error messages may not be able to point to the precise location and text of the error.
callstack - is the callstack. If callstack is null a new one will be created with the declaring namespace of the method on top of the stack (i.e. it will look for purposes of the method invocation like the method call occurred in the declaring (enclosing) namespace in which the method is defined).
EvalError

toString

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


© 2000 pat@pat.net :-)