Java examples for java.lang.annotation:Method Annotation
get Method Parameter Annotations
//package com.java2s; import java.lang.annotation.Annotation; import java.lang.reflect.Method; public class Main { public static Annotation[][] getParameterAnnotations(Method method) { Annotation[][] annotations = method.getParameterAnnotations(); Class<?> cl = method.getDeclaringClass(); while (annotations == null) { cl = cl.getSuperclass();/*from w ww .ja va 2 s . c o m*/ if (cl == null || cl == Object.class) { break; } try { Method equivalentMethod = cl.getDeclaredMethod( method.getName(), method.getParameterTypes()); annotations = equivalentMethod.getParameterAnnotations(); } catch (NoSuchMethodException e) { // We're done... } } return annotations; } }