我试着缩短它。 我想通过" getMethods()"遍历类的方法。现在,当方法具有参数时,该参数是"事件" class,应该调用它。
示例方法:
PrintNALUnitType(h264_nu);
" ExampleEvent"是"事件"的一个实例。类。
非常感谢帮助!
答案 0 :(得分:0)
您想使用getParameterTypes()
代替getParameters()
。如果要将参数类型与参数名称匹配,只需将两个数组索引相同即可。
答案 1 :(得分:0)
Something Like this, its been awhile since i wrote in java but This something like this should work
Method[] methods = Class.getMethods();
List<Method> methodsWithEvent = new List<Method>();
for(Method method : methods){
Class[] params = method.getParameterTypes();
for(Class class : params)
if(typeof(class) == typeof(ExampleEvent))
methodsWithEvents.add(method);
}