How can i pass a datatype of type long as a param for method which is accepting arbitrary param Class...
I am actually trying to get the reflection of a method from the below class.
Class Fun(){public Object getBox(long boxId, String boxName){}}
Trying to access this method using below Code.
Class clazz = new fun().getClass(); String str = "Welcome"; Method method = clazz.getMethod("getBox",new Long(22).getClass, str.getClass());
Iam getting the below exception when i try accessing the method name for invoking.
java.lang.NoSuchMethodException:
How to pass a long and a string variable for parametertypes in the below method signature.
public Method getMethod(String name,
Class<?>... parameterTypes)
throws NoSuchMethodException,
SecurityException
Aucun commentaire:
Enregistrer un commentaire