Method[] methods = beanClass.getMethods(); for (Method method : methods) { Validate validation = method.getAnnotation(Validate.class); if (validation != null) { String fieldName = getPropertyName(method.getName()); fieldValidations.put(fieldName, validation); }  ValidateNestedProperties nested = method.getAnnotation(ValidateNestedProperties.class); if (nested != null) { String fieldName = getPropertyName(method.getName()); Validate[] validations = nested.value(); for (Validate nestedValidate : validations) { if ( "".equals(nestedValidate.field()) ) { log.warn("Nested validation used without field name: ", validation); } else { fieldValidations.put(fieldName + "." + nestedValidate.field(), nestedValidate); } } } }    Field[] fields = beanClass.getFields(); for (Field field : fields) { Validate validation = field.getAnnotation(Validate.class); if (validation != null) { fieldValidations.put(field.getName(), validation); }  ValidateNestedProperties nested = field.getAnnotation(ValidateNestedProperties.class); if (nested != null) { Validate[] validations = nested.value(); for (Validate nestedValidate : validations) { if ( "".equals(nestedValidate.field()) ) { log.warn("Nested validation used without field name: ", validation); } else { fieldValidations.put(field.getName() + "." + nestedValidate.field(), nestedValidate); } } } }
processClassAnnotations(beanClass, fieldValidations);
    public void init(Configuration configuration) throws Exception {        this.configuration = configuration;        Set<Class<ActionBean>> beanClasses = ActionClassCache.getInstance().getActionBeanClasses();        this.validations = new HashMap<Class<ActionBean>, Map<String,Validate>>();        for (Class<ActionBean> beanClass : beanClasses) {            Map<String, Validate> fieldValidations = new HashMap<String, Validate>();            // Process the methods on the class            Method[] methods = beanClass.getMethods();            for (Method method : methods) {                Validate validation = method.getAnnotation(Validate.class);                if (validation != null) {                    String fieldName = getPropertyName(method.getName());                    fieldValidations.put(fieldName, validation);                }                ValidateNestedProperties nested = method.getAnnotation(ValidateNestedProperties.class);                if (nested != null) {                    String fieldName = getPropertyName(method.getName());                    Validate[] validations = nested.value();                    for (Validate nestedValidate : validations) {                        if ( "".equals(nestedValidate.field()) ) {                            log.warn("Nested validation used without field name: ", validation);                        }                        else {                            fieldValidations.put(fieldName + "." + nestedValidate.field(),                                                 nestedValidate);                        }                    }                }            }            // Process the fields for validation annotations            Field[] fields = beanClass.getFields();            for (Field field : fields) {                Validate validation = field.getAnnotation(Validate.class);                if (validation != null) {                    fieldValidations.put(field.getName(), validation);                }                ValidateNestedProperties nested = field.getAnnotation(ValidateNestedProperties.class);                if (nested != null) {                    Validate[] validations = nested.value();                    for (Validate nestedValidate : validations) {                        if ( "".equals(nestedValidate.field()) ) {                            log.warn("Nested validation used without field name: ", validation);                        }                        else {                            fieldValidations.put(field.getName() + "." + nestedValidate.field(),                                                 nestedValidate);                        }                    }                }            }            this.validations.put(beanClass, fieldValidations);            log.info("Loaded validations for ActionBean ", beanClass.getName(), ":",                     fieldValidations);        }    }