when i check the parameter of the method which is in a class using java reflection for java.math.BigDecimal
and java.lang.String
isPrimitive()
return false. yes they are not primitive but i want to differnciate between user defined class and these java class
Class[] parameterTypes = method2.getParameterTypes();
for (Class class1 : parameterTypes) { // check the parameter type and put them in to a ArrayList
methodParams = new MethodParams();
strClassNameToFix = class1.getName();
strClassname =strClassNameToFix.replaceAll("\\[L", "").replaceAll("\\;","");
methodParams.setDataType(strClassname);
if(class1.isArray()){
methodParams.setArray(true);
}
if(class1.isPrimitive()){
methodParams.setPrimitive(true);
}
tempParamsList.add(methodParams);
}
based on the above code i set true of false methodParams.setPrimitive(true);
i have done this because there are few cases where i get user defined object , in my case com.hexgen.ro.request.CreateOrderRO
so how to set this?
also using reflection i get the class name, methods declared in it and the arguments type for the method.
But i am not able to get the argument name like if i have declared a method like the following :
class test{
public String testMethod(int a, String b){
return "test";
}
}
in the above code i am able to get the folloing
Class name : test
Method name : testMethod
Arguments Type : int and String
But i also want to get int a and String b
type of the argument as well as the declared variable name
How to do this.
Please help me to get this done.
Best Regards