@Test public void shouldNotReturnExcludedField() { AnnotatedClass annotatedClass = new AnnotatedClass(TestModelWithASingleAnnotatedMember.class, Lists.newArrayList( TestModelWithASingleAnnotatedMember.class.getName() + "#notNullString"), BuiltInConstraint.getAllBeanValidationAnnotations()); ClassConstraints classConstraints = annotatedClass.extractValidationRules(); assertThat(classConstraints.entrySet(), is(empty())); }
ClassConstraints extractValidationRules() { final ClassConstraints classConstraints = new ClassConstraints(); Set<Field> allFields = ReflectionUtils.getAllFields(clazz, buildAnnotationsPredicate()); for (Field field : allFields) { if (isNotExcluded(field)) { FieldConstraints fieldValidationRules = new AnnotatedField(field, relevantAnnotationClasses).extractValidationRules(); if (fieldValidationRules.size() > 0) { classConstraints.put(field.getName(), fieldValidationRules); } } } return classConstraints; }
AnnotatedClass { ClassConstraints extractValidationRules() { final ClassConstraints classConstraints = new ClassConstraints(); Set<Field> allFields = ReflectionUtils.getAllFields(clazz, buildAnnotationsPredicate()); for (Field field : allFields) { if (isNotExcluded(field)) { FieldConstraints fieldValidationRules = new AnnotatedField(field, relevantAnnotationClasses).extractValidationRules(); if (fieldValidationRules.size() > 0) { classConstraints.put(field.getName(), fieldValidationRules); } } } return classConstraints; } }
AnnotatedClass { ClassConstraints extractValidationRules() { final ClassConstraints classConstraints = new ClassConstraints(); Set<Field> allFields = ReflectionUtils.getAllFields(clazz, buildAnnotationsPredicate()); for (Field field : allFields) { if (isNotExcluded(field)) { FieldConstraints fieldValidationRules = new AnnotatedField(field, relevantAnnotationClasses).extractValidationRules(); if (fieldValidationRules.size() > 0) { classConstraints.put(field.getName(), fieldValidationRules); } } } return classConstraints; } AnnotatedClass(Class clazz, List<String> excludedFields, Iterable<Class<? extends Annotation>>
    relevantAnnotationClasses); }
AnnotatedClass { ClassConstraints extractValidationRules() { final ClassConstraints classConstraints = new ClassConstraints(); Set<Field> allFields = ReflectionUtils.getAllFields(clazz, buildAnnotationsPredicate()); for (Field field : allFields) { if (isNotExcluded(field)) { FieldConstraints fieldValidationRules = new AnnotatedField(field, relevantAnnotationClasses).extractValidationRules(); if (fieldValidationRules.size() > 0) { classConstraints.put(field.getName(), fieldValidationRules); } } } return classConstraints; } AnnotatedClass(Class clazz, List<String> excludedFields, Iterable<Class<? extends Annotation>>
    relevantAnnotationClasses);  }
AnnotatedClass { ClassConstraints extractValidationRules() { final ClassConstraints classConstraints = new ClassConstraints(); Set<Field> allFields = ReflectionUtils.getAllFields(clazz, buildAnnotationsPredicate()); for (Field field : allFields) { if (isNotExcluded(field)) { FieldConstraints fieldValidationRules = new AnnotatedField(field, relevantAnnotationClasses).extractValidationRules(); if (fieldValidationRules.size() > 0) { classConstraints.put(field.getName(), fieldValidationRules); } } } return classConstraints; } AnnotatedClass(Class clazz, List<String> excludedFields, Iterable<Class<? extends Annotation>>
    relevantAnnotationClasses);   }