如何通过反射找到具有特定参数的所有方法?

时间:2022-05-10 11:17:44

I need to find all the methods in a class that accept a set of parameters in a specific order, some of them are generics (Collection). The example on the Sun web site only works with non generic classes:

我需要在类中找到以特定顺序接受一组参数的所有方法,其中一些是泛型(Collection)。 Sun网站上的示例仅适用于非泛型类:

http://java.sun.com/docs/books/tutorial/reflect/member/methodInvocation.html

cheers in advance

提前喝彩

1 个解决方案

#1


Method.getGenericParameterTypes is the method for you!

Method.getGenericParameterTypes就是你的方法!

<insert usual comment about reflection almost certainly being a bad idea here>

<插入关于反思的通常评论几乎肯定是一个坏主意>

#1


Method.getGenericParameterTypes is the method for you!

Method.getGenericParameterTypes就是你的方法!

<insert usual comment about reflection almost certainly being a bad idea here>

<插入关于反思的通常评论几乎肯定是一个坏主意>