Here you can find the source of getMethodValue(Class annotationClasss, Class targetClass, String... annotationFields)
public static Map<String, Map<String, Object>> getMethodValue(Class annotationClasss, Class targetClass, String... annotationFields) throws Exception
//package com.java2s; //License from project: Open Source License import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; public class Main { public static Map<String, Map<String, Object>> getMethodValue(Class annotationClasss, Class targetClass, String... annotationFields) throws Exception { Map<String, Map<String, Object>> map = new HashMap<String, Map<String, Object>>(20); Method[] methods = targetClass.getDeclaredMethods(); for (Method method : methods) { if (method.isAnnotationPresent(annotationClasss)) { Map<String, Object> methodMap = new HashMap<String, Object>(10); Annotation p = method.getAnnotation(annotationClasss); for (String annotationField : annotationFields) { Method m = p.getClass().getDeclaredMethod(annotationField); if (m == null) { continue; }/*from ww w .ja va 2s . co m*/ Object value = m.invoke(p); methodMap.put(annotationField, value); } } } return map; } }