Top Description Fields Constructors Methods
bsh

public Class BshMethod

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Known Direct Subclasses
bsh.DelayedEvalBshMethod
Imports
java.lang.reflect.Method, .InvocationTargetException

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

Modifier and TypeField and Description
private Class<T>[]
private Class<T>
pack-priv NameSpace
private Method
private Object
pack-priv BSHBlock
pack-priv Modifiers
private String
private int
private String[]

Constructor Summary

AccessConstructor and Description
pack-priv
BshMethod(BSHMethodDeclaration method, NameSpace declaringNameSpace, Modifiers modifiers)

pack-priv
BshMethod(String name, Class<T> returnType, String[] paramNames, Class<T>[] paramTypes, BSHBlock methodBody, NameSpace declaringNameSpace, Modifiers modifiers)

pack-priv
BshMethod(Method method, Object object)

Method Summary

Modifier and TypeMethod and Description
public Modifiers
public String
public String[]
public Class<T>[]
getParameterTypes()

Get the argument types of this method.

public Class<T>

Returns:

Returns null for a loosely typed return value, Void.TYPE for a void return type, or the Class of the type.
getReturnType
()

Get the return type of the method.

public boolean
public Object
invoke(Object[] argValues, Interpreter interpreter)

Invoke the declared method with the specified arguments and interpreter reference.

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

Invoke the bsh method with the specified args, interpreter ref, and callstack.

pack-priv Object
invoke(Object[] argValues, Interpreter interpreter, 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).
callstack
,
SimpleNode
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.
callerInfo
,
boolean
When true the method is executed in the namespace on the top of the stack instead of creating its own local namespace. This allows it to be used in constructors.
overrideNameSpace
)

Invoke the bsh method with the specified args, interpreter ref, and callstack.

private Object
invokeImpl(Object[] argValues, Interpreter interpreter, CallStack callstack, SimpleNode callerInfo, boolean overrideNameSpace)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

cparamTypesback to summary
private Class<T>[] cparamTypes
creturnTypeback to summary
private Class<T> creturnType
declaringNameSpaceback to summary
pack-priv NameSpace declaringNameSpace
javaMethodback to summary
private Method javaMethod
javaObjectback to summary
private Object javaObject
methodBodyback to summary
pack-priv BSHBlock methodBody
modifiersback to summary
pack-priv Modifiers modifiers
nameback to summary
private String name
numArgsback to summary
private int numArgs
paramNamesback to summary
private String[] paramNames

Constructor Detail

BshMethodback to summary
pack-priv BshMethod(BSHMethodDeclaration method, NameSpace declaringNameSpace, Modifiers modifiers)
BshMethodback to summary
pack-priv BshMethod(String name, Class<T> returnType, String[] paramNames, Class<T>[] paramTypes, BSHBlock methodBody, NameSpace declaringNameSpace, Modifiers modifiers)
BshMethodback to summary
pack-priv BshMethod(Method method, Object object)

Method Detail

getModifiersback to summary
public Modifiers getModifiers()
getNameback to summary
public String getName()
getParameterNamesback to summary
public String[] getParameterNames()
getParameterTypesback to summary
public Class<T>[] getParameterTypes()

Get the argument types of this method. loosely typed (untyped) arguments will be represented by null argument types.

getReturnTypeback to summary
public Class<T> getReturnType()

Get the return type of the method.

Returns:Class<T>

Returns null for a loosely typed return value, Void.TYPE for a void return type, or the Class of the type.

hasModifierback to summary
public boolean hasModifier(String name)
invokeback to summary
public Object invoke(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.

invokeback to summary
public Object invoke(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
callstack: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).

callerInfo:SimpleNode

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.

invokeback to summary
pack-priv Object invoke(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.

Parameters
callstack: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).

callerInfo:SimpleNode

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.

overrideNameSpace:boolean

When true the method is executed in the namespace on the top of the stack instead of creating its own local namespace. This allows it to be used in constructors.

invokeImplback to summary
private Object invokeImpl(Object[] argValues, Interpreter interpreter, CallStack callstack, SimpleNode callerInfo, boolean overrideNameSpace) throws EvalError
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.