Skip to content

Commit a61b506

Browse files
committed
Types: add paramTypes(Method, Class) method
This is like returnType(Method, Class), but for method parameter types, rather than its return type. it leans on GenTyRef's getExactParameterTypes to do the work.
1 parent a95c5fb commit a61b506

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/main/java/org/scijava/util/Types.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,15 @@ public static Type returnType(final Method method, final Class<?> type) {
525525
return GenericTypeReflector.getExactReturnType(method, wildType);
526526
}
527527

528+
/**
529+
* As {@link #type(Field, Class)}, but with respect to the parameter types of
530+
* the given {@link Method} rather than a {@link Field}.
531+
*/
532+
public static Type[] paramTypes(final Method method, final Class<?> type) {
533+
final Type wildType = GenericTypeReflector.addWildcardParameters(type);
534+
return GenericTypeReflector.getExactParameterTypes(method, wildType);
535+
}
536+
528537
/**
529538
* Gets the given type's {@code n}th type parameter of the specified class.
530539
* <p>

0 commit comments

Comments
 (0)