agentland.debug
Class Caller

java.lang.Object
  |
  +--agentland.debug.Caller

public class Caller
extends Object


Constructor Summary
Caller()
           
 
Method Summary
static Vector getMethods(Object o, String method)
          Returns all methods with a given name for a given object
static Class[] getParamTypes(Object[] params)
          Given an array of objects, returns an array of types
static Object runMethod(Object obj, Method m, Object[] oParams)
          Performs the actual call on the method and returns the result as an Object
static Object runMethod(Object obj, Method m, String sParams)
          Stolen from agentland.debug.MethodList Given a method to run with the String parameters parameter line, it will run the method on the agent specific to this MethodList.
static Object runMethod(Object obj, String method, Object[] params)
           
static Object runMethod(Object o, String method, String params)
          Will call a method on an object given a string that can be parsed into a list of arguments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Caller

public Caller()
Method Detail

runMethod

public static Object runMethod(Object o,
                               String method,
                               String params)
                        throws CallerFailedException
Will call a method on an object given a string that can be parsed into a list of arguments. This method works by selecting all plausible methods from the object and trying them by calling the other runMethod method (the one that takes method as a Method object rather than a string)
Returns:
the return value of the method turned into an object
Throws:
CallerFailedException - if an error occurs

getMethods

public static Vector getMethods(Object o,
                                String method)
Returns all methods with a given name for a given object

runMethod

public static Object runMethod(Object obj,
                               Method m,
                               String sParams)
                        throws CallerFailedException
Stolen from agentland.debug.MethodList Given a method to run with the String parameters parameter line, it will run the method on the agent specific to this MethodList. For parsing the params (which is most of the code), it uses commas as separators, trims the String of outer spaces, removes outer-most single/double quotes. For the class it must be (mapping the primitives to the corresponding object wrapper types), it searches for a constructor taking a single String, and it runs that with the input. "null" is translated as a null. The status bar is changed with the return value.

runMethod

public static Object runMethod(Object obj,
                               String method,
                               Object[] params)
                        throws CallerFailedException

getParamTypes

public static Class[] getParamTypes(Object[] params)
Given an array of objects, returns an array of types

runMethod

public static Object runMethod(Object obj,
                               Method m,
                               Object[] oParams)
                        throws CallerFailedException
Performs the actual call on the method and returns the result as an Object
Throws:
CallerFailedException - if an error occurs