Java examples for java.lang.annotation:Method Annotation
get Methods With Annotation
//package com.java2s; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; public class Main { public static List<Method> getMethodsWithAnnotation(Class<?> klass, Class<? extends Annotation> annotation) { List<Method> methodList = new ArrayList<Method>(); for (Method m : klass.getMethods()) { if (m.isAnnotationPresent(annotation)) { methodList.add(m);//from w w w. java 2 s .c o m } } return methodList; } }