dimanche 7 juin 2015

Get a retrun value from dynamically calling java class

I need to get a retrun value from dynamically calling java class by passing a variable values to that calling method. I try to use the java.lang.reflect.Method;

PredictionManager pm = new PredictionManager();
Class invokeclass = pm.getClass();

Class[] cArg = new Class[1];
cArg[0] = Integer.class;//Instances.class;

Method lMethod = invokeclass.getMethod("showLong", cArg);
Object aaa= lMethod.invoke(pm, cArg);

in there I need to pass the value as a argument. but this method needs to give the parameter type. not the parameter value.

What can I do?





Aucun commentaire:

Enregistrer un commentaire