Here you can find the source of getAnnotationAttributes(Annotation annotation)
public static Map<String, Object> getAnnotationAttributes(Annotation annotation)
//package com.java2s; //License from project: Apache 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, Object> getAnnotationAttributes(Annotation annotation) { return getAnnotationAttributes(annotation, false); }//from w ww . ja v a 2 s . com public static Map<String, Object> getAnnotationAttributes(Annotation annotation, boolean classValuesAsString) { Map<String, Object> attrs = new HashMap<String, Object>(); Method[] methods = annotation.annotationType().getDeclaredMethods(); for (Method method : methods) { if (method.getParameterTypes().length == 0 && method.getReturnType() != void.class) { try { Object value = method.invoke(annotation); if (classValuesAsString) { if (value instanceof Class) { value = ((Class) value).getName(); } else if (value instanceof Class[]) { Class[] clazzArray = (Class[]) value; String[] newValue = new String[clazzArray.length]; for (int i = 0; i < clazzArray.length; i++) { newValue[i] = clazzArray[i].getName(); } value = newValue; } } attrs.put(method.getName(), value); } catch (Exception ex) { throw new IllegalStateException("Could not obtain annotation attribute values", ex); } } } return attrs; } }