In my code I am having following scenario..
class MyClass {
void myMethod(String arg1, String arg2) {
//Some stuff
}
}
I am having an instance for the MyClass in some other class. I invoked the myMethod by using following code,
MethodUtils.invokeMethod(myClassInstance, "myMethod", managerMethodArguments)
managerMethodArguments were passed from another object which has the following code
String one = "one";
String two = null;
Object[] managerMethodArguments = {one, two};
The above code throws null pointer exception. The thing is I will not know the class type of managerMethodArguments, If I know then I can invoke by another method which has the class type. Any solutions?? How to proceed forward??
Edited:
I am using org.apache.commons.lang.reflect.MethodUtils