Skip to content

Commit dc5fc64

Browse files
authored
Merge pull request #112 from SentryMan/patch-1
Update README a bit
2 parents 44b7104 + 0bcc5a6 commit dc5fc64

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ Reflection-free pojo validation via apt source code generation. A light (~85kb +
1111
- `avaje-validator-generator` annotation processor generates Java source code to write validation classes
1212
- Supports Avaje/Jakarta/Javax Constraint Annotations
1313
- Groups Support
14+
- Class level Constraints
1415
- Composable Contraint Annotations
16+
- Inheritable Constraints
1517
- loading and interpolating error messages (with multiple Locales) through ResourceBundles
16-
- Getter Validation
18+
- Getter Validation
1719
- Method parameter validation (requires a DI container to retrieve the generated MethodAdapter classes)
1820

1921
# Quick Start
@@ -41,13 +43,14 @@ And add avaje-validator-generator as an annotation processor.
4143
<groupId>io.avaje</groupId>
4244
<artifactId>avaje-validator-generator</artifactId>
4345
<version>${avaje.validator.version}</version>
46+
<optional>true</optional>
4447
<scope>provided</scope>
4548
</dependency>
4649
```
4750

4851
## Step 2 - Add (Avaje/Jakarta/Javax) `@Valid`
4952

50-
Add `@Valid` to the types we want to add validation.
53+
Add `@Valid` to the types we want to add validation.
5154

5255
The `avaje-validator-generator` annotation processor will generate validation adapter classes as Java source code
5356
for each type annotated with `@Valid`. These will be automatically registered with `Validator`
@@ -121,11 +124,11 @@ public final class AddressValidationAdapter implements ValidationAdapter<Address
121124
private final ValidationAdapter<String> cityValidationAdapter;
122125

123126
public AddressValidationAdapter(ValidationContext ctx) {
124-
this.streetValidationAdapter =
127+
this.streetValidationAdapter =
125128
ctx.<String>adapter(NotBlank.class, Map.of("message","{avaje.NotBlank.message}"));
126-
this.suburbValidationAdapter =
129+
this.suburbValidationAdapter =
127130
ctx.<String>adapter(NotEmpty.class, Map.of("message","must not be empty"));
128-
this.cityValidationAdapter =
131+
this.cityValidationAdapter =
129132
ctx.<String>adapter(NotNull.class, Map.of("message","{avaje.NotNull.message}", "groups",Set.of(example.avaje.typeuse.SomeGroup.class)));
130133
}
131134

validator/src/main/java/io/avaje/validation/adapter/ValidationAdapter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*
1010
* @param <T> The type of value to be validated
1111
*/
12+
@FunctionalInterface
1213
public interface ValidationAdapter<T> {
1314

1415
/**

0 commit comments

Comments
 (0)