Mil*_*ara -1 java reflection dynamic-method
我需要通过将变量值传递给该调用方法来动态调用java类来获取retrun值.我尝试使用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);
Run Code Online (Sandbox Code Playgroud)
在那里我需要传递值作为参数.但是这个方法需要给出参数类型.不是参数值.
我能做什么?
| 归档时间: |
|
| 查看次数: |
327 次 |
| 最近记录: |