@@ -11,9 +11,11 @@ Reflection-free pojo validation via apt source code generation. A light (~85kb +
11
11
- ` avaje-validator-generator ` annotation processor generates Java source code to write validation classes
12
12
- Supports Avaje/Jakarta/Javax Constraint Annotations
13
13
- Groups Support
14
+ - Class level Constraints
14
15
- Composable Contraint Annotations
16
+ - Inheritable Constraints
15
17
- loading and interpolating error messages (with multiple Locales) through ResourceBundles
16
- - Getter Validation
18
+ - Getter Validation
17
19
- Method parameter validation (requires a DI container to retrieve the generated MethodAdapter classes)
18
20
19
21
# Quick Start
@@ -41,13 +43,14 @@ And add avaje-validator-generator as an annotation processor.
41
43
<groupId >io.avaje</groupId >
42
44
<artifactId >avaje-validator-generator</artifactId >
43
45
<version >${avaje.validator.version}</version >
46
+ <optional >true</optional >
44
47
<scope >provided</scope >
45
48
</dependency >
46
49
```
47
50
48
51
## Step 2 - Add (Avaje/Jakarta/Javax) ` @Valid `
49
52
50
- Add ` @Valid ` to the types we want to add validation.
53
+ Add ` @Valid ` to the types we want to add validation.
51
54
52
55
The ` avaje-validator-generator ` annotation processor will generate validation adapter classes as Java source code
53
56
for each type annotated with ` @Valid ` . These will be automatically registered with ` Validator `
@@ -121,11 +124,11 @@ public final class AddressValidationAdapter implements ValidationAdapter<Address
121
124
private final ValidationAdapter<String > cityValidationAdapter;
122
125
123
126
public AddressValidationAdapter (ValidationContext ctx ) {
124
- this . streetValidationAdapter =
127
+ this . streetValidationAdapter =
125
128
ctx. < String > adapter(NotBlank . class, Map . of(" message" ," {avaje.NotBlank.message}" ));
126
- this . suburbValidationAdapter =
129
+ this . suburbValidationAdapter =
127
130
ctx. < String > adapter(NotEmpty . class, Map . of(" message" ," must not be empty" ));
128
- this . cityValidationAdapter =
131
+ this . cityValidationAdapter =
129
132
ctx. < String > adapter(NotNull . class, Map . of(" message" ," {avaje.NotNull.message}" , " groups" ,Set . of(example.avaje.typeuse. SomeGroup . class)));
130
133
}
131
134
0 commit comments