org.apache.jorphan.reflect

Class ClassTools


public class ClassTools
extends Object

Utility methods for handling dynamic access to classes.

Method Summary

static Object
construct(String className)
Call no-args constructor for a class.
static Object
construct(String className, int parameter)
Call a class constructor with an integer parameter
static void
invoke(Object instance, String methodName)
Invoke a public method on a class instance

Method Details

construct

public static Object construct(String className)
            throws JMeterException
Call no-args constructor for a class.
Parameters:
className -
Returns:
an instance of the class
Throws:
JMeterException - if class cannot be created

construct

public static Object construct(String className,
                               int parameter)
            throws JMeterException
Call a class constructor with an integer parameter
Parameters:
className -
parameter - (integer)
Returns:
an instance of the class
Throws:
JMeterException - if class cannot be created

invoke

public static void invoke(Object instance,
                          String methodName)
            throws SecurityException,
                   IllegalArgumentException,
                   JMeterException
Invoke a public method on a class instance
Parameters:
instance -
methodName -
Throws:
JMeterException -

Copyright © 1998-2010 Apache Software Foundation. All Rights Reserved.