Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

bsh
Class BshMethod  view BshMethod download BshMethod.java

java.lang.Object
  extended bybsh.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.

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.


Field Summary
private  java.lang.String[] argNames
           
private  java.lang.Class[] argTypes
           
(package private)  NameSpace declaringNameSpace
           
private  BSHBlock methodBody
           
(package private)  Modifiers modifiers
           
private  java.lang.String name
           
private  int numArgs
           
private  java.lang.Object returnType
           
 
Constructor Summary
(package private) BshMethod(BSHMethodDeclaration method, NameSpace declaringNameSpace, Modifiers modifiers)
           
(package private) BshMethod(java.lang.String name, java.lang.Object returnType, java.lang.String[] argNames, java.lang.Class[] argTypes, BSHBlock methodBody, NameSpace declaringNameSpace, Modifiers modifiers)
           
 
Method Summary
 java.lang.Class[] getArgumentTypes()
          Get the argument types of this method.
(package private)  Modifiers getModifiers()
           
 java.lang.String getName()
           
 java.lang.Object getReturnType()
          Get the return type of the method.
 boolean hasModifier(java.lang.String name)
           
 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, SimpleNode callerInfo)
           
 java.lang.Object invoke(java.lang.Object[] argValues, Interpreter interpreter, CallStack callstack, SimpleNode callerInfo, boolean overrideNameSpace)
          Invoke the bsh method with the specified args, interpreter ref, and callstack.
private  java.lang.Object invokeImpl(java.lang.Object[] argValues, Interpreter interpreter, CallStack callstack, SimpleNode callerInfo, boolean overrideNameSpace)
           
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

declaringNameSpace

NameSpace declaringNameSpace

modifiers

Modifiers modifiers

name

private java.lang.String name

returnType

private java.lang.Object returnType

argNames

private java.lang.String[] argNames

numArgs

private int numArgs

argTypes

private java.lang.Class[] argTypes

methodBody

private BSHBlock methodBody
Constructor Detail

BshMethod

BshMethod(BSHMethodDeclaration method,
          NameSpace declaringNameSpace,
          Modifiers modifiers)

BshMethod

BshMethod(java.lang.String name,
          java.lang.Object returnType,
          java.lang.String[] argNames,
          java.lang.Class[] argTypes,
          BSHBlock methodBody,
          NameSpace declaringNameSpace,
          Modifiers modifiers)
Method Detail

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.


getModifiers

Modifiers getModifiers()

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.


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.


invoke

public java.lang.Object invoke(java.lang.Object[] argValues,
                               Interpreter interpreter,
                               CallStack callstack,
                               SimpleNode callerInfo)
                        throws EvalError

invoke

public java.lang.Object invoke(java.lang.Object[] argValues,
                               Interpreter interpreter,
                               CallStack callstack,
                               SimpleNode callerInfo,
                               boolean overrideNameSpace)
                        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.


invokeImpl

private java.lang.Object invokeImpl(java.lang.Object[] argValues,
                                    Interpreter interpreter,
                                    CallStack callstack,
                                    SimpleNode callerInfo,
                                    boolean overrideNameSpace)
                             throws EvalError

hasModifier

public boolean hasModifier(java.lang.String name)

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).