package gov.nih.nci.cbiit.cmts.function;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class FunctionInvoker {

	public static Object invokeFunctionMethod(String functionName, String methodName, Object argList[]) throws FunctionException
	{
       Class targetClass;
		try {
			targetClass = Class.forName(functionName);
			Method[] allMethods=targetClass.getMethods();
			//find the target method by name
			Method targetMethod=null;
			for (Method oneMethod:allMethods)
			{
				if (oneMethod.getName().equals(methodName)){
					targetMethod=oneMethod;
					break;
				}
			}
			if (targetMethod==null)
				throw new FunctionException("Not found method:"+methodName);	        
	        Object retObj  = targetMethod.invoke(targetClass.newInstance(), argList);
	        System.out.println("FunctionInvoker.invokeFunctionMethod()...return:"+retObj);
	        return retObj;
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			throw new FunctionException(e.getMessage());
		} catch (IllegalArgumentException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			throw new FunctionException(e.getMessage());
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			throw new FunctionException(e.getMessage());
		} catch (InvocationTargetException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			throw new FunctionException(e.getMessage());
		} catch (InstantiationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			throw new FunctionException(e.getMessage());
		}
	}
}

@@ -295,47 +295,88 @@
 %09%7B%0D%0A
-       Class targetClass;%0D%0A%09%09try %7B%0D%0A%09%09%09
+%09%09try %7B%0D%0A%09%09%09// Use Class%3C?%3E if the class being modeled is unknown.%0D%0A%09%09%09Class%3C?%3E 
 targ

Set the type of the class modeled by a class object