net.sourceforge.mflow.reflect
Class ReflectionUtil

java.lang.Object
  extended bynet.sourceforge.mflow.reflect.ReflectionUtil

public class ReflectionUtil
extends java.lang.Object

Author:
carrd

Constructor Summary
ReflectionUtil()
           
 
Method Summary
static java.lang.Object instantiate(java.lang.Class clazz, java.util.List sigs)
          Attempts to create an instance of a Class given a List of ParamArgPairs.
static java.lang.Object instantiate(java.lang.String className, java.util.List sigs)
          Attempts to create an instance of a class based on its name and a List of ParamArgPairs.
static java.lang.Object invokeMethod(java.lang.Object obj, java.lang.String methodName, java.util.List sigs)
          Attempts to invoke a named method on an arbitrary object, given a List of ParamArgPairs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectionUtil

public ReflectionUtil()
Method Detail

instantiate

public static java.lang.Object instantiate(java.lang.String className,
                                           java.util.List sigs)
                                    throws ReflectionException
Attempts to create an instance of a class based on its name and a List of ParamArgPairs.

Parameters:
className - the name of a class
sigs - a list of ParamArgPairs to try in order
Returns:
an instance of the class
Throws:
ReflectionException - if an instance could not be obtained

instantiate

public static java.lang.Object instantiate(java.lang.Class clazz,
                                           java.util.List sigs)
                                    throws ReflectionException
Attempts to create an instance of a Class given a List of ParamArgPairs.

Parameters:
clazz - a Class object
sigs - a list of ParamArgPairs to try in order
Returns:
an instance of the class
Throws:
ReflectionException - if an instance could not be obtained

invokeMethod

public static java.lang.Object invokeMethod(java.lang.Object obj,
                                            java.lang.String methodName,
                                            java.util.List sigs)
                                     throws ReflectionException
Attempts to invoke a named method on an arbitrary object, given a List of ParamArgPairs.

Parameters:
obj - the object to invoke the method on
methodName - the name of the method to invoke
sigs - the List of ParamArgPairs
Returns:
the return value of the method, or null if none
Throws:
ReflectionException - if the method cannot be called


Copyright © 2002-2004 MFlow Group. All Rights Reserved.