Skip to content

Commit c271239

Browse files
committed
Tidy Javadoc
1 parent 0af1086 commit c271239

File tree

6 files changed

+35
-8
lines changed

6 files changed

+35
-8
lines changed

validator/src/main/java/io/avaje/validation/ConstraintViolation.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,21 @@ public class ConstraintViolation {
1010
private final String propertyName;
1111
private final String message;
1212

13+
/**
14+
* Create the ConstraintViolation with the given path, property and message.
15+
*/
1316
public ConstraintViolation(String path, String propertyName, String message) {
1417
this.path = path;
1518
this.propertyName = propertyName;
1619
this.message = message;
1720
}
1821

19-
/** Return the path that this violation occurred for */
22+
/** Return the path for this constraint violation */
2023
public String path() {
2124
return path;
2225
}
2326

27+
/** Return the property name for this constraint violation */
2428
public String propertyName() {
2529
return propertyName;
2630
}
@@ -32,7 +36,6 @@ public String message() {
3236

3337
@Override
3438
public String toString() {
35-
3639
return message;
3740
}
3841
}

validator/src/main/java/io/avaje/validation/ConstraintViolationException.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
22

33
import java.util.Set;
44

5+
/**
6+
* Exception holding a set of constraint violations.
7+
*/
58
public final class ConstraintViolationException extends RuntimeException {
69

710
private final Set<ConstraintViolation> violations;
811

12+
/** Create with the given constraint violations */
913
public ConstraintViolationException(Set<ConstraintViolation> violations) {
1014
this.violations = violations;
1115
}
1216

17+
/** Return the constraint violations. */
1318
public Set<ConstraintViolation> violations() {
1419
return violations;
1520
}

validator/src/main/java/io/avaje/validation/Validator.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,13 @@ interface Builder {
5252

5353
/**
5454
* Add ResourceBundle for error message interpolation
55-
*
56-
* @param bundleName the name of the bundleFiles
5755
*/
5856
Builder addResourceBundles(ResourceBundle... bundle);
5957

6058
/** Set Default Locale for this validator, if not set, will use Locale.getDefault() */
6159
Builder setDefaultLocale(Locale defaultLocale);
6260

63-
/** Adds an additional Locales for this validator */
61+
/** Adds additional Locales for this validator */
6462
Builder addLocales(Locale... locales);
6563

6664
/** Add a AdapterBuilder which provides a ValidationAdapter to use for the given type. */

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ default boolean validate(T value, ValidationRequest req) {
1414
return validate(value, req, null);
1515
}
1616

17+
@SuppressWarnings("unchecked")
1718
default ValidationAdapter<T> list(ValidationContext ctx, Class<?> clazz) {
1819
final var after = ctx.<Object>adapter(clazz);
1920
return (value, req, propertyName) -> {
@@ -24,6 +25,7 @@ default ValidationAdapter<T> list(ValidationContext ctx, Class<?> clazz) {
2425
};
2526
}
2627

28+
@SuppressWarnings("unchecked")
2729
default ValidationAdapter<T> map(ValidationContext ctx, Class<?> clazz) {
2830
final var after = ctx.<Object>adapter(clazz);
2931
return (value, req, propertyName) -> {

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
import java.lang.reflect.Type;
55
import java.util.Map;
66

7-
import io.avaje.validation.adapter.ValidationContext.Message;
8-
7+
/**
8+
* Context available when validation adapters are being created.
9+
*/
910
public interface ValidationContext {
1011

1112
/**
Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,31 @@
11
package io.avaje.validation.adapter;
22

3+
/**
4+
* A validation request.
5+
*/
36
public interface ValidationRequest {
47

5-
void addViolation(ValidationContext.Message msg, String propertyName);
8+
/**
9+
* Add a constraint violation for the given property.
10+
*
11+
* @param message The message
12+
* @param propertyName The property that failed the constraint
13+
*/
14+
void addViolation(ValidationContext.Message message, String propertyName);
615

16+
/**
17+
* Push the nested path.
18+
*/
719
void pushPath(String path);
820

21+
/**
22+
* Pop the nested path.
23+
*/
924
void popPath();
1025

26+
/**
27+
* Throw ConstraintViolationException if there are violations for this request.
28+
*/
1129
void throwWithViolations();
1230

1331
}

0 commit comments

Comments
 (0)