edu.northwestern.at.utils
Class DynamicCall

java.lang.Object
  extended by edu.northwestern.at.utils.DynamicCall

public class DynamicCall
extends java.lang.Object

DynamicCall.

DynamicCall provides methods for dynamically calling methods in classes with specified arguments. The class may be specified by its class type or by name. The method is provided by name. The list of parameters is passed as an ArgumentList. DynamicCall uses Java reflection.


Constructor Summary
protected DynamicCall()
          Don't allow instantiation, do allow overrides.
 
Method Summary
static java.lang.Object dynamicCall(java.lang.Object classToCall, java.lang.String methodName, ArgumentList argumentList)
          Use reflection to call a named method from a specified class.
static java.lang.Object dynamicCall(java.lang.String className, java.lang.String methodName, ArgumentList argumentList)
          Use reflection to call a named method from a named class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamicCall

protected DynamicCall()
Don't allow instantiation, do allow overrides.

Method Detail

dynamicCall

public static java.lang.Object dynamicCall(java.lang.Object classToCall,
                                           java.lang.String methodName,
                                           ArgumentList argumentList)
                                    throws java.lang.NoSuchMethodException,
                                           java.lang.reflect.InvocationTargetException,
                                           java.lang.IllegalAccessException
Use reflection to call a named method from a specified class.

Parameters:
classToCall - The class containing the method to call.
methodName - The method name to call.
argumentList - The argument list.
Throws:
java.lang.NoSuchMethodException
java.lang.reflect.InvocationTargetException
java.lang.IllegalAccessException

dynamicCall

public static java.lang.Object dynamicCall(java.lang.String className,
                                           java.lang.String methodName,
                                           ArgumentList argumentList)
                                    throws java.lang.NoSuchMethodException,
                                           java.lang.reflect.InvocationTargetException,
                                           java.lang.IllegalAccessException,
                                           java.lang.ClassNotFoundException,
                                           java.lang.InstantiationException
Use reflection to call a named method from a named class.

Parameters:
className - The class name containing the method to call.
methodName - The method name to call.
argumentList - The argument list.
Throws:
java.lang.NoSuchMethodException
java.lang.reflect.InvocationTargetException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException
java.lang.InstantiationException