From 4b05563583504f98768eb2decac56eddfe3ad364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tero=20Hagstr=C3=B6m?= Date: Tue, 27 Sep 2016 12:24:57 +0300 Subject: [PATCH 1/6] Implemented support for outputting JSR 303 validation groups in the generated JSON. https://github.com/netceteragroup/valdr-bean-validation/issues/31 --- .idea/codeStyleSettings.xml | 6 + .idea/misc.xml | 2 +- .idea/uiDesigner.xml | 125 ++++++++++++++++++ .../com/github/valdr/demo/model/Person.java | 3 +- .../main/resources/valdr-bean-validation.json | 3 +- .../valdr-bean-validation-demo.iml | 3 +- .../java/com/github/valdr/AnnotatedClass.java | 22 ++- .../java/com/github/valdr/AnnotatedField.java | 6 +- .../github/valdr/ConstraintAttributes.java | 27 +++- .../com/github/valdr/ConstraintParser.java | 2 +- .../main/java/com/github/valdr/Options.java | 6 + .../github/valdr/ClasspathScannerTest.java | 2 +- .../github/valdr/ConstraintParserTest.java | 36 +++++ .../j/TestModelWithValidationGroups.java | 15 +++ .../github/valdr/util/ValidationGroup.java | 11 ++ 15 files changed, 253 insertions(+), 16 deletions(-) create mode 100644 .idea/uiDesigner.xml create mode 100644 valdr-bean-validation/src/test/java/com/github/valdr/model/j/TestModelWithValidationGroups.java create mode 100644 valdr-bean-validation/src/test/java/com/github/valdr/util/ValidationGroup.java diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml index 9178b38..b4f1cbd 100644 --- a/.idea/codeStyleSettings.xml +++ b/.idea/codeStyleSettings.xml @@ -6,8 +6,14 @@ + + + + + - + diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..3b00020 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/valdr-bean-validation-demo/src/main/java/com/github/valdr/demo/model/Person.java b/valdr-bean-validation-demo/src/main/java/com/github/valdr/demo/model/Person.java index 28dc8b1..5d57311 100644 --- a/valdr-bean-validation-demo/src/main/java/com/github/valdr/demo/model/Person.java +++ b/valdr-bean-validation-demo/src/main/java/com/github/valdr/demo/model/Person.java @@ -6,11 +6,12 @@ import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; +import javax.validation.groups.Default; public class Person { @NotNull(message = "\\foo") private String firstName; - @Size(min = 4, max = 31) + @Size(min = 4, max = 31, groups={Default.class}) private String lastName; @CreditCardNumber private String creditCardNumber; diff --git a/valdr-bean-validation-demo/src/main/resources/valdr-bean-validation.json b/valdr-bean-validation-demo/src/main/resources/valdr-bean-validation.json index ea6bbf7..ffc15e3 100644 --- a/valdr-bean-validation-demo/src/main/resources/valdr-bean-validation.json +++ b/valdr-bean-validation-demo/src/main/resources/valdr-bean-validation.json @@ -5,5 +5,6 @@ "customAnnotationClasses": ["org.hibernate.validator.constraints.CreditCardNumber"], "corsAllowOriginPattern": "*", "outputFullTypeName": false, - "outputFile": "${project.build.directory}/${project.build.finalName}/constraints.json" + "outputFile": "${project.build.directory}/${project.build.finalName}/constraints.json", + "outputValidationGroups": false } \ No newline at end of file diff --git a/valdr-bean-validation-demo/valdr-bean-validation-demo.iml b/valdr-bean-validation-demo/valdr-bean-validation-demo.iml index eb17b9b..348addb 100644 --- a/valdr-bean-validation-demo/valdr-bean-validation-demo.iml +++ b/valdr-bean-validation-demo/valdr-bean-validation-demo.iml @@ -40,4 +40,5 @@ - \ No newline at end of file + + diff --git a/valdr-bean-validation/src/main/java/com/github/valdr/AnnotatedClass.java b/valdr-bean-validation/src/main/java/com/github/valdr/AnnotatedClass.java index fdd3f6a..f0819b0 100644 --- a/valdr-bean-validation/src/main/java/com/github/valdr/AnnotatedClass.java +++ b/valdr-bean-validation/src/main/java/com/github/valdr/AnnotatedClass.java @@ -19,6 +19,7 @@ public class AnnotatedClass { private final Class clazz; private final List excludedFields; private final Iterable> relevantAnnotationClasses; + private final boolean outputValidationGroups; /** * @param clazz wrapped class @@ -27,10 +28,27 @@ public class AnnotatedClass { * AnnotatedClass#extractValidationRules()} is invoked */ AnnotatedClass(Class clazz, List excludedFields, Iterable> - relevantAnnotationClasses) { + relevantAnnotationClasses) { this.clazz = clazz; this.excludedFields = excludedFields; this.relevantAnnotationClasses = relevantAnnotationClasses; + this.outputValidationGroups = false; + } + + /** + * @param clazz wrapped class + * @param excludedFields collection of fully qualified field names which are skipped by the parser + * @param relevantAnnotationClasses only these annotation classes are considered when {@link + * AnnotatedClass#extractValidationRules()} is invoked + * @param outputValidationGroups Whether to output the value of the validation groups attribute of the validation + * annotations. + */ + AnnotatedClass(Class clazz, List excludedFields, Iterable> + relevantAnnotationClasses, boolean outputValidationGroups) { + this.clazz = clazz; + this.excludedFields = excludedFields; + this.relevantAnnotationClasses = relevantAnnotationClasses; + this.outputValidationGroups = outputValidationGroups; } /** @@ -45,7 +63,7 @@ ClassConstraints extractValidationRules() { for (Field field : allFields) { if (isNotExcluded(field)) { FieldConstraints fieldValidationRules = new AnnotatedField(field, - relevantAnnotationClasses).extractValidationRules(); + relevantAnnotationClasses, outputValidationGroups).extractValidationRules(); if (fieldValidationRules.size() > 0) { classConstraints.put(field.getName(), fieldValidationRules); } diff --git a/valdr-bean-validation/src/main/java/com/github/valdr/AnnotatedField.java b/valdr-bean-validation/src/main/java/com/github/valdr/AnnotatedField.java index 4bb6952..449e8ce 100644 --- a/valdr-bean-validation/src/main/java/com/github/valdr/AnnotatedField.java +++ b/valdr-bean-validation/src/main/java/com/github/valdr/AnnotatedField.java @@ -12,15 +12,17 @@ public class AnnotatedField { private final Field field; private final Iterable> relevantAnnotationClasses; + private final boolean outputValidationGroups; /** * @param field wrapped field * @param relevantAnnotationClasses only these annotation classes are considered when {@link * AnnotatedField#extractValidationRules()} is invoked */ - AnnotatedField(Field field, Iterable> relevantAnnotationClasses) { + AnnotatedField(Field field, Iterable> relevantAnnotationClasses, boolean outputValidationGroups) { this.field = field; this.relevantAnnotationClasses = relevantAnnotationClasses; + this.outputValidationGroups = outputValidationGroups; } /** @@ -35,7 +37,7 @@ FieldConstraints extractValidationRules() { for (Annotation annotation : annotations) { if (Iterables.contains(relevantAnnotationClasses, annotation.annotationType())) { - ConstraintAttributes constraintAttributes = new ConstraintAttributes(annotation); + ConstraintAttributes constraintAttributes = new ConstraintAttributes(annotation, outputValidationGroups); BuiltInConstraint supportedValidator = BuiltInConstraint.valueOfAnnotationClassOrNull(annotation .annotationType()); if (supportedValidator == null) { diff --git a/valdr-bean-validation/src/main/java/com/github/valdr/ConstraintAttributes.java b/valdr-bean-validation/src/main/java/com/github/valdr/ConstraintAttributes.java index c315f08..1346d45 100644 --- a/valdr-bean-validation/src/main/java/com/github/valdr/ConstraintAttributes.java +++ b/valdr-bean-validation/src/main/java/com/github/valdr/ConstraintAttributes.java @@ -3,10 +3,7 @@ import com.github.valdr.thirdparty.spring.AnnotationUtils; import java.lang.annotation.Annotation; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; +import java.util.*; /** * All attributes of a constraint (i.e. Bean Validation annotation attributes). @@ -14,15 +11,22 @@ public class ConstraintAttributes implements MinimalObjectMap { private final Map map = new HashMap<>(); + private final boolean outputValidationGroups; + private static final String GROUPS = "groups"; /** * Constructor. * * @param annotation annotation which is queried for attributes */ - public ConstraintAttributes(Annotation annotation) { + public ConstraintAttributes(Annotation annotation, boolean outputValidationGroups) { + this.outputValidationGroups = outputValidationGroups; Map annotationAttributes = AnnotationUtils.getAnnotationAttributes(annotation); removeUnusedAttributes(annotationAttributes); + if (outputValidationGroups) { + validationGroupClassNamesToSimple(annotationAttributes); + } + map.putAll(annotationAttributes); } @@ -45,9 +49,20 @@ private void removeUnusedAttributes(Map annotationAttributes) { Iterator it = annotationAttributes.keySet().iterator(); while (it.hasNext()) { String key = it.next(); - if ("groups".equals(key) || "payload".equals(key)) { + if ("payload".equals(key) || (GROUPS.equals(key) && !outputValidationGroups)) { it.remove(); } } } + + private void validationGroupClassNamesToSimple(Map annotationAttributes) { + if (annotationAttributes.containsKey(GROUPS)) { + Class[] groupClasses = (Class[])annotationAttributes.get(GROUPS); + List simpleNames = new ArrayList<>(); + for(Class groupClass: groupClasses) { + simpleNames.add(groupClass.getSimpleName()); + } + annotationAttributes.put(GROUPS, simpleNames); + } + } } diff --git a/valdr-bean-validation/src/main/java/com/github/valdr/ConstraintParser.java b/valdr-bean-validation/src/main/java/com/github/valdr/ConstraintParser.java index fdbae5f..53f2310 100644 --- a/valdr-bean-validation/src/main/java/com/github/valdr/ConstraintParser.java +++ b/valdr-bean-validation/src/main/java/com/github/valdr/ConstraintParser.java @@ -54,7 +54,7 @@ public String parse() { for (Class clazz : classpathScanner.findClassesToParse()) { if (clazz != null) { ClassConstraints classValidationRules = new AnnotatedClass(clazz, options.getExcludedFields(), - allRelevantAnnotationClasses).extractValidationRules(); + allRelevantAnnotationClasses, options.getOutputValidationGroups()).extractValidationRules(); if (classValidationRules.size() > 0) { String name = options.getOutputFullTypeName() ? clazz.getName() : clazz.getSimpleName(); classNameToValidationRulesMap.put(name, classValidationRules); diff --git a/valdr-bean-validation/src/main/java/com/github/valdr/Options.java b/valdr-bean-validation/src/main/java/com/github/valdr/Options.java index 92993b4..e5a910a 100644 --- a/valdr-bean-validation/src/main/java/com/github/valdr/Options.java +++ b/valdr-bean-validation/src/main/java/com/github/valdr/Options.java @@ -83,6 +83,12 @@ public final class Options { */ private String outputFile = StringUtils.EMPTY; + /** + * Whether to output validation annotation group attribute values in the meta-model (JSON). If omitted, validation group + * values are not written. + */ + private Boolean outputValidationGroups = Boolean.FALSE; + /** * Validates the consistency and integrity of the configured options. * diff --git a/valdr-bean-validation/src/test/java/com/github/valdr/ClasspathScannerTest.java b/valdr-bean-validation/src/test/java/com/github/valdr/ClasspathScannerTest.java index 2377f72..a938a41 100644 --- a/valdr-bean-validation/src/test/java/com/github/valdr/ClasspathScannerTest.java +++ b/valdr-bean-validation/src/test/java/com/github/valdr/ClasspathScannerTest.java @@ -58,7 +58,7 @@ public void shouldExcludedConfiguredClasses() { Set> classesToParse = classpathScanner.findClassesToParse(); // then assertThat(classesToParse, notContains(TestModelWithASingleAnnotatedMember.class)); - assertThat(classesToParse.size(), is(10)); + assertThat(classesToParse.size(), is(11)); } private Matcher>> notContains(final Class testModelClass) { diff --git a/valdr-bean-validation/src/test/java/com/github/valdr/ConstraintParserTest.java b/valdr-bean-validation/src/test/java/com/github/valdr/ConstraintParserTest.java index bac950d..c94493b 100644 --- a/valdr-bean-validation/src/test/java/com/github/valdr/ConstraintParserTest.java +++ b/valdr-bean-validation/src/test/java/com/github/valdr/ConstraintParserTest.java @@ -12,6 +12,7 @@ import com.github.valdr.model.f.TestModelWithHibernateEmailAnnotation; import com.github.valdr.model.g.TestModelWithHibernateUrlAnnotation; import com.github.valdr.model.h.TestModelWithPatterns; +import com.github.valdr.model.j.TestModelWithValidationGroups; import com.github.valdr.model.validation.CustomValidation; import com.google.common.collect.Lists; import org.junit.Test; @@ -218,6 +219,33 @@ public void shouldDecoratePatternConstraint() { assertThat(json, containsString("/\\\\\\\\abc\\\\./")); // JSON needs to escape \ -> double escape here } + @Test + public void shouldIncludeValidationGroupWhenSoConfigured() { + // given + parserConfiguredFor(Lists.newArrayList(TestModelWithValidationGroups.class.getPackage().getName()), emptyStringList(), true); + // when + String json = parser.parse(); + // then + String expected = "{\n" + + " \"TestModelWithValidationGroups\" : {\n" + + " \"bar\" : {\n" + + " \"required\" : {\n" + + " \"message\" : \"{javax.validation.constraints.NotNull.message}\",\n" + + " \"groups\" : [ \"GroupTwo\", \"GroupOne\" ]\n" + + " }\n" + + " },\n" + + " \"foo\" : {\n" + + " \"required\" : {\n" + + " \"message\" : \"{javax.validation.constraints.NotNull.message}\",\n" + + " \"groups\" : [ \"GroupOne\" ]\n" + + " }\n" + + " }\n" + + " }\n" + + "}"; + assertThat(json, is(expected)); + } + + private void parserConfiguredFor(List modelPackages, List customAnnotationClasses) { Options options = new Options(); options.setModelPackages(modelPackages); @@ -225,6 +253,14 @@ private void parserConfiguredFor(List modelPackages, List custom parser = new ConstraintParser(options); } + private void parserConfiguredFor(List modelPackages, List customAnnotationClasses, boolean outputValidationGroups) { + Options options = new Options(); + options.setModelPackages(modelPackages); + options.setCustomAnnotationClasses(customAnnotationClasses); + options.setOutputValidationGroups(outputValidationGroups); + parser = new ConstraintParser(options); + } + private List emptyStringList() { return Collections.emptyList(); } diff --git a/valdr-bean-validation/src/test/java/com/github/valdr/model/j/TestModelWithValidationGroups.java b/valdr-bean-validation/src/test/java/com/github/valdr/model/j/TestModelWithValidationGroups.java new file mode 100644 index 0000000..b87c19e --- /dev/null +++ b/valdr-bean-validation/src/test/java/com/github/valdr/model/j/TestModelWithValidationGroups.java @@ -0,0 +1,15 @@ +package com.github.valdr.model.j; + +import com.github.valdr.util.ValidationGroup; +import lombok.Getter; + +import javax.validation.constraints.NotNull; + +@Getter +public class TestModelWithValidationGroups { + @NotNull(groups = ValidationGroup.GroupOne.class) + private String foo; + + @NotNull(groups = {ValidationGroup.GroupTwo.class, ValidationGroup.GroupOne.class}) + private String bar; +} diff --git a/valdr-bean-validation/src/test/java/com/github/valdr/util/ValidationGroup.java b/valdr-bean-validation/src/test/java/com/github/valdr/util/ValidationGroup.java new file mode 100644 index 0000000..42ab412 --- /dev/null +++ b/valdr-bean-validation/src/test/java/com/github/valdr/util/ValidationGroup.java @@ -0,0 +1,11 @@ +package com.github.valdr.util; + +public class ValidationGroup { + public interface GroupOne { + // validation group marker interface + } + + public interface GroupTwo { + // validation group marker interface + } +} \ No newline at end of file From c0d9e39c0d044e3b3503e1769a358209ff0fd97e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tero=20Hagstr=C3=B6m?= Date: Thu, 29 Sep 2016 17:14:56 +0300 Subject: [PATCH 2/6] When outputting the groups, they are now expanded into their interface ancestry. Also, if groups are not specified, outputting ['Default']. Removed accidentally added uiDesigner.xml --- .idea/encodings.xml | 3 +- .idea/misc.xml | 2 +- .idea/uiDesigner.xml | 125 ------------------ valdr-bean-validation-parent.iml | 3 +- .../github/valdr/ConstraintAttributes.java | 22 ++- .../github/valdr/ConstraintParserTest.java | 20 ++- .../j/TestModelWithValidationGroups.java | 14 +- .../github/valdr/util/ValidationGroup.java | 4 +- .../valdr-bean-validation.iml | 3 +- 9 files changed, 55 insertions(+), 141 deletions(-) delete mode 100644 .idea/uiDesigner.xml diff --git a/.idea/encodings.xml b/.idea/encodings.xml index 12108cd..cf1353c 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -7,4 +7,5 @@ - \ No newline at end of file + + diff --git a/.idea/misc.xml b/.idea/misc.xml index 96401ec..55a314f 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -16,7 +16,7 @@ - + diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml deleted file mode 100644 index 3b00020..0000000 --- a/.idea/uiDesigner.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/valdr-bean-validation-parent.iml b/valdr-bean-validation-parent.iml index b26c4d0..b475024 100644 --- a/valdr-bean-validation-parent.iml +++ b/valdr-bean-validation-parent.iml @@ -9,4 +9,5 @@ - \ No newline at end of file + + diff --git a/valdr-bean-validation/src/main/java/com/github/valdr/ConstraintAttributes.java b/valdr-bean-validation/src/main/java/com/github/valdr/ConstraintAttributes.java index 1346d45..d5ddbaf 100644 --- a/valdr-bean-validation/src/main/java/com/github/valdr/ConstraintAttributes.java +++ b/valdr-bean-validation/src/main/java/com/github/valdr/ConstraintAttributes.java @@ -56,13 +56,29 @@ private void removeUnusedAttributes(Map annotationAttributes) { } private void validationGroupClassNamesToSimple(Map annotationAttributes) { - if (annotationAttributes.containsKey(GROUPS)) { - Class[] groupClasses = (Class[])annotationAttributes.get(GROUPS); + Class[] groupClasses = (Class[])annotationAttributes.get(GROUPS); + if (groupClasses.length > 0) { List simpleNames = new ArrayList<>(); for(Class groupClass: groupClasses) { - simpleNames.add(groupClass.getSimpleName()); + for(Class c: getThisAndAncestors(groupClass)) { + simpleNames.add(c.getSimpleName()); + } } annotationAttributes.put(GROUPS, simpleNames); + } else { + annotationAttributes.put(GROUPS, new String[]{"Default"}); } } + + private List getThisAndAncestors(Class aClass) { + List ret = new ArrayList<>(); + if (!aClass.equals(Object.class)) { + ret.add(aClass); + } + Class[] parents = aClass.getInterfaces(); + for(Class parent: parents) { + ret.addAll(getThisAndAncestors(parent)); + } + return ret; + } } diff --git a/valdr-bean-validation/src/test/java/com/github/valdr/ConstraintParserTest.java b/valdr-bean-validation/src/test/java/com/github/valdr/ConstraintParserTest.java index c94493b..ebccd21 100644 --- a/valdr-bean-validation/src/test/java/com/github/valdr/ConstraintParserTest.java +++ b/valdr-bean-validation/src/test/java/com/github/valdr/ConstraintParserTest.java @@ -228,16 +228,28 @@ public void shouldIncludeValidationGroupWhenSoConfigured() { // then String expected = "{\n" + " \"TestModelWithValidationGroups\" : {\n" + - " \"bar\" : {\n" + + " \"justTwo\" : {\n" + " \"required\" : {\n" + " \"message\" : \"{javax.validation.constraints.NotNull.message}\",\n" + - " \"groups\" : [ \"GroupTwo\", \"GroupOne\" ]\n" + + " \"groups\" : [ \"GroupTwo\" ]\n" + " }\n" + " },\n" + - " \"foo\" : {\n" + + " \"noGroupSpecifiedMeansDefault\" : {\n" + " \"required\" : {\n" + " \"message\" : \"{javax.validation.constraints.NotNull.message}\",\n" + - " \"groups\" : [ \"GroupOne\" ]\n" + + " \"groups\" : [ \"Default\" ]\n" + + " }\n" + + " },\n" + + " \"twoOneAndDefault\" : {\n" + + " \"required\" : {\n" + + " \"message\" : \"{javax.validation.constraints.NotNull.message}\",\n" + + " \"groups\" : [ \"GroupTwo\", \"GroupOne\", \"Default\" ]\n" + + " }\n" + + " },\n" + + " \"oneAndDefault\" : {\n" + + " \"required\" : {\n" + + " \"message\" : \"{javax.validation.constraints.NotNull.message}\",\n" + + " \"groups\" : [ \"GroupOne\", \"Default\" ]\n" + " }\n" + " }\n" + " }\n" + diff --git a/valdr-bean-validation/src/test/java/com/github/valdr/model/j/TestModelWithValidationGroups.java b/valdr-bean-validation/src/test/java/com/github/valdr/model/j/TestModelWithValidationGroups.java index b87c19e..8ff58d5 100644 --- a/valdr-bean-validation/src/test/java/com/github/valdr/model/j/TestModelWithValidationGroups.java +++ b/valdr-bean-validation/src/test/java/com/github/valdr/model/j/TestModelWithValidationGroups.java @@ -7,9 +7,15 @@ @Getter public class TestModelWithValidationGroups { - @NotNull(groups = ValidationGroup.GroupOne.class) - private String foo; + @NotNull(groups = ValidationGroup.GroupOne.class) + private String oneAndDefault; - @NotNull(groups = {ValidationGroup.GroupTwo.class, ValidationGroup.GroupOne.class}) - private String bar; + @NotNull(groups = {ValidationGroup.GroupTwo.class, ValidationGroup.GroupOne.class}) + private String twoOneAndDefault; + + @NotNull(groups = {ValidationGroup.GroupTwo.class}) + private String justTwo; + + @NotNull + private String noGroupSpecifiedMeansDefault; } diff --git a/valdr-bean-validation/src/test/java/com/github/valdr/util/ValidationGroup.java b/valdr-bean-validation/src/test/java/com/github/valdr/util/ValidationGroup.java index 42ab412..081b06b 100644 --- a/valdr-bean-validation/src/test/java/com/github/valdr/util/ValidationGroup.java +++ b/valdr-bean-validation/src/test/java/com/github/valdr/util/ValidationGroup.java @@ -1,7 +1,9 @@ package com.github.valdr.util; +import javax.validation.groups.Default; + public class ValidationGroup { - public interface GroupOne { + public interface GroupOne extends Default { // validation group marker interface } diff --git a/valdr-bean-validation/valdr-bean-validation.iml b/valdr-bean-validation/valdr-bean-validation.iml index 0a0ba32..cd7176c 100644 --- a/valdr-bean-validation/valdr-bean-validation.iml +++ b/valdr-bean-validation/valdr-bean-validation.iml @@ -40,4 +40,5 @@ - \ No newline at end of file + + From 80e95485119ef16bdf9088a24cd0447335334163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tero=20Hagstr=C3=B6m?= Date: Tue, 4 Oct 2016 15:09:20 +0300 Subject: [PATCH 3/6] When outputting the groups, they are now expanded into their descendants instead of ancestry. Added a new option validationGroupPackages to make subclass search work better. --- .idea/misc.xml | 1 + .idea/uiDesigner.xml | 125 ++++++++++++++++++ .../com/github/valdr/ClasspathScanner.java | 31 ++++- .../github/valdr/ConstraintAttributes.java | 39 +++--- .../main/java/com/github/valdr/Options.java | 14 +- .../github/valdr/ConstraintParserTest.java | 23 ++-- .../j/TestModelWithValidationGroups.java | 4 +- .../github/valdr/util/ValidationGroup.java | 15 ++- 8 files changed, 211 insertions(+), 41 deletions(-) create mode 100644 .idea/uiDesigner.xml diff --git a/.idea/misc.xml b/.idea/misc.xml index 55a314f..6269f0b 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -9,6 +9,7 @@ +