Code example for Annotation

Methods: annotationType

0
    private Map<String, Object> buildAnnotationParameterMap() {
        final Method[] declaredMethods;
        if (System.getSecurityManager() != null) {
            declaredMethods = AccessController.doPrivileged(new PrivilegedAction<Method[]>() {
                public Method[] run() {
                    return annotation.annotationType().getDeclaredMethods();
                } 
            }); 
        } else { 
            declaredMethods = annotation.annotationType().getDeclaredMethods();
        } 
        Map<String, Object> parameters = new HashMap<String, Object>(declaredMethods.length);
        for (Method m : declaredMethods) {
            try { 
                parameters.put(m.getName(), m.invoke(annotation));
            } catch (IllegalAccessException e) {
                throw new ValidationException("Unable to read annotation attributes: " + annotation.getClass(), e);
            } catch (InvocationTargetException e) {
                throw new ValidationException("Unable to read annotation attributes: " + annotation.getClass(), e);
            } 
        }