public class MethodUtil
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.Object |
callMethod(java.lang.Object o,
java.lang.String methodCalled,
java.lang.Object... params)
Call the specified method with the specified arguments, converting the
argument type if necessary.
|
static java.lang.Object |
getClassFromConfig(java.lang.String className,
java.lang.Object... args)
Get an instance of a class that can have its classname overridden in our config
system.
|
static java.lang.Object |
invokeStaticMethod(java.lang.Class clazz,
java.lang.String method,
java.lang.Object[] args)
Invoke a static method from a class.
|
public static java.lang.Object invokeStaticMethod(java.lang.Class clazz, java.lang.String method, java.lang.Object[] args) throws java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
clazz
- The Class to search for the specified methodmethod
- The method to execute.args
- the Arguments to the method.java.lang.NoSuchMethodException
- If the method can't be foundjava.lang.IllegalAccessException
- if the method cannot be accessedjava.lang.reflect.InvocationTargetException
- if the method throws an exceptionpublic static java.lang.Object callMethod(java.lang.Object o, java.lang.String methodCalled, java.lang.Object... params)
o
- The object from which to call the methodmethodCalled
- The method to callparams
- a Collection of the parameters to methodCalledpublic static java.lang.Object getClassFromConfig(java.lang.String className, java.lang.Object... args)
className
- to fetchargs
- arguments to the constructor.