ReflectionMethodUtils { public static <A extends Annotation> List<A> getMethodParameterAnnotations(Method method, int index, Class<A> annotationClass) { Annotation[][] parametersAnnotations = method.getParameterAnnotations(); Annotation[] parameterAnnotations = parametersAnnotations[index]; List<A> foundAnnotations = new ArrayList<>(); for (Annotation annotation : parameterAnnotations) { if (annotationClass.isInstance(annotation)) { foundAnnotations.add((A) annotation); } } return foundAnnotations; } private  ReflectionMethodUtils(); static List<A> getMethodParameterAnnotations(Method method, int index,
        Class<A> annotationClass); static List<A> getMethodParameterAnnotations(Method method, int index,
        Class<A> annotationClass, boolean inherits);  }
@Test void testGetMethodParameterAnnotations() throws SecurityException, NoSuchMethodException { assertEquals( 1, ReflectionMethodUtils.getMethodParameterAnnotations( TestImplementation.class.getMethod("methodWithAnnotationParameter", new Class<?>[]{ Object.class }), 0, TestInheritedAnnotation.class, true).size()); assertEquals( 0, ReflectionMethodUtils.getMethodParameterAnnotations( TestImplementation.class.getMethod("methodWithAnnotationParameter", new Class<?>[]{ Object.class }), 0, TestInheritedAnnotation.class, false).size()); }