import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
public class Util{
public static Method findAnnotatedMethod(Class> clazz, Class extends Annotation> annotationClass) {
for (Method method : clazz.getMethods())
if( method.isAnnotationPresent(annotationClass))
return(method);
return(null);
}
public static List findAnnotatedMethods(Class> clazz, Class extends Annotation> annotationClass) {
Method[] methods = clazz.getMethods();
List annotatedMethods = new ArrayList(methods.length);
for (Method method : methods) {
if( method.isAnnotationPresent(annotationClass)){
annotatedMethods.add(method);
}
}
return annotatedMethods;
}
}