I have some 3rd-party API with method someFn(int code, int[] data).
How can I express types (particulary array-typed argument) outside API container (interface class) for usage in Class.getMethod(name, Integer.class, ???.class);? How can I describe argument of array type properly?
As far as I know, I may use workaround like, but is there a better way of doing this?
class C { void f(int[] a) {} } }
C.class.getDeclaredMethods()[0].getParameterTypes()[0]
Thanks in advance
You can use
int[].classto get the class literal ofint []and pass it toClass.getMethod: