Skip to content

Commit 3d5d0f3

Browse files
Mechiterbygrave
andauthored
Reformat & correct the JavaDoc of all constraints (#325)
* Reformat & correct the JavaDoc of all constraints Signed-off-by: Mechite <[email protected]> * Better JavaDoc for `@NotBlank` constraint `#max()` feature Signed-off-by: Mechite <[email protected]> * Javadoc - Use Return instead of @return when there is no description * Javadoc - indentation on unordered lists --------- Signed-off-by: Mechite <[email protected]> Co-authored-by: Rob Bygrave <[email protected]>
1 parent f8e9054 commit 3d5d0f3

19 files changed

+139
-117
lines changed

validator-constraints/src/main/java/io/avaje/validation/constraints/AssertFalse.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
import java.lang.annotation.Target;
1212

1313
/**
14-
* The annotated element must be false. Supported types are {@code boolean} and {@code Boolean}.
15-
*
16-
* <p>{@code null} elements are considered valid.
14+
* The annotated element must be false.
15+
* Supported types are {@code boolean} and {@code Boolean}.
16+
* <p>
17+
* {@code null} elements are considered valid.
1718
*
1819
* @author Emmanuel Bernard
1920
*/

validator-constraints/src/main/java/io/avaje/validation/constraints/AssertTrue.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
import java.lang.annotation.Target;
1212

1313
/**
14-
* The annotated element must be true. Supported types are {@code boolean} and {@code Boolean}.
15-
*
16-
* <p>{@code null} elements are considered valid.
14+
* The annotated element must be true.
15+
* Supported types are {@code boolean} and {@code Boolean}.
16+
* <p>
17+
* {@code null} elements are considered valid.
1718
*
1819
* @author Emmanuel Bernard
1920
*/

validator-constraints/src/main/java/io/avaje/validation/constraints/Constraint.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
import java.lang.annotation.Target;
88

99
/**
10-
* Marks an annotation as a Constraint class. Only annotations marked with Constraint are composable
10+
* Marks an annotation as a constraint class.
11+
* Only annotations marked with {@code @Constraint} are composable.
1112
*/
1213
@Retention(CLASS)
1314
@Target({ANNOTATION_TYPE})

validator-constraints/src/main/java/io/avaje/validation/constraints/DecimalMax.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,18 @@
1414
/**
1515
* The annotated element must be a number whose value must be lower or equal to the specified
1616
* maximum.
17-
*
18-
* <p>Supported types are:
19-
*
17+
* <p>
18+
* Supported types are:
2019
* <ul>
2120
* <li>{@code BigDecimal}
2221
* <li>{@code BigInteger}
2322
* <li>{@code CharSequence}
2423
* <li>{@code byte}, {@code short}, {@code int}, {@code long}, and their respective wrappers
2524
* </ul>
26-
*
2725
* Note that {@code double} and {@code float} are not supported due to rounding errors (some
2826
* providers might provide some approximative support).
29-
*
30-
* <p>{@code null} elements are considered valid.
27+
* <p>
28+
* {@code null} elements are considered valid.
3129
*
3230
* @author Emmanuel Bernard
3331
*/
@@ -52,8 +50,8 @@
5250
/**
5351
* Specifies whether the specified maximum is inclusive or exclusive. By default, it is inclusive.
5452
*
55-
* @return {@code true} if the value must be lower or equal to the specified maximum, {@code
56-
* false} if the value must be lower
53+
* @return {@code true} if the value must be lower or equal to the specified maximum,
54+
* {@code false} if the value must be lower
5755
* @since 1.1
5856
*/
5957
boolean inclusive() default true;

validator-constraints/src/main/java/io/avaje/validation/constraints/DecimalMin.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,18 @@
2020
/**
2121
* The annotated element must be a number whose value must be higher or equal to the specified
2222
* minimum.
23-
*
24-
* <p>Supported types are:
25-
*
23+
* <p>
24+
* Supported types are:
2625
* <ul>
2726
* <li>{@code BigDecimal}
2827
* <li>{@code BigInteger}
2928
* <li>{@code CharSequence}
3029
* <li>{@code byte}, {@code short}, {@code int}, {@code long}, and their respective wrappers
3130
* </ul>
32-
*
3331
* Note that {@code double} and {@code float} are not supported due to rounding errors (some
3432
* providers might provide some approximative support).
35-
*
36-
* <p>{@code null} elements are considered valid.
33+
* <p>
34+
* {@code null} elements are considered valid.
3735
*
3836
* @author Emmanuel Bernard
3937
*/
@@ -58,8 +56,8 @@
5856
/**
5957
* Specifies whether the specified maximum is inclusive or exclusive. By default, it is inclusive.
6058
*
61-
* @return {@code true} if the value must be lower or equal to the specified maximum, {@code
62-
* false} if the value must be lower
59+
* @return {@code true} if the value must be lower or equal to the specified maximum,
60+
* {@code false} if the value must be lower
6361
* @since 1.1
6462
*/
6563
boolean inclusive() default true;

validator-constraints/src/main/java/io/avaje/validation/constraints/Digits.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,16 @@
1515

1616
/**
1717
* The annotated element must be a number within accepted range.
18-
*
19-
* <p>Supported types are:
20-
*
18+
* <p>
19+
* Supported types are:
2120
* <ul>
2221
* <li>{@code BigDecimal}
2322
* <li>{@code BigInteger}
2423
* <li>{@code CharSequence}
2524
* <li>{@code byte}, {@code short}, {@code int}, {@code long}, and their respective wrapper types
2625
* </ul>
27-
*
28-
* <p>{@code null} elements are considered valid.
26+
* <p>
27+
* {@code null} elements are considered valid.
2928
*
3029
* @author Emmanuel Bernard
3130
*/
@@ -38,14 +37,21 @@
3837

3938
Class<?>[] groups() default {};
4039

40+
/** Return maximum number of integral digits accepted for this number */
4141
int integer();
4242

43+
/** Return maximum number of fractional digits accepted for this number */
4344
int fraction() default 0;
4445

46+
/**
47+
* Defines several {@link Digits} annotations on the same element.
48+
*
49+
* @see Digits
50+
*/
4551
@Target({ElementType.METHOD, ElementType.FIELD})
4652
@Retention(RetentionPolicy.RUNTIME)
4753
@Documented
48-
public @interface Digitses {
54+
@interface Digitses {
4955
Digits[] value();
5056
}
5157
}

validator-constraints/src/main/java/io/avaje/validation/constraints/Email.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313

1414
/**
1515
* The string has to be a well-formed email address. Exact semantics of what makes up a valid email
16-
* address are left to the provided Email Annotation ValidationAdapter providers. Accepts {@code
17-
* CharSequence}.
18-
*
19-
* <p>{@code null} elements are considered valid.
16+
* address are left to the provided Email Annotation ValidationAdapter providers.
17+
* <p>
18+
* Accepts {@code CharSequence}.
19+
* {@code null} elements are considered valid.
2020
*/
2121
@Constraint
2222
@Documented

validator-constraints/src/main/java/io/avaje/validation/constraints/Future.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@
1313

1414
/**
1515
* The annotated element must be an instant, date or time in the future.
16-
*
17-
* <p><i>Now</i> is defined by the {@link Clock} Supplier attached to the {@link Validator}. The
16+
* <p>
17+
* <i>Now</i> is defined by the {@code Clock} Supplier attached to the {@code Validator}. The
1818
* default clock defines the current time according to the virtual machine, applying the current
1919
* default time zone if needed.
20-
*
21-
* <p>Supported types are:
22-
*
20+
* <p>
21+
* Supported types are:
2322
* <ul>
2423
* <li>{@code java.util.Date}
2524
* <li>{@code java.util.Calendar}
@@ -34,8 +33,8 @@
3433
* <li>{@code java.time.YearMonth}
3534
* <li>{@code java.time.ZonedDateTime}
3635
* </ul>
37-
*
38-
* <p>{@code null} elements are considered valid.
36+
* <p>
37+
* {@code null} elements are considered valid.
3938
*/
4039
@Constraint
4140
@Documented

validator-constraints/src/main/java/io/avaje/validation/constraints/FutureOrPresent.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,15 @@
1313

1414
/**
1515
* The annotated element must be an instant, date or time in the present or in the future.
16-
*
17-
* <p><i>Now</i> is defined by the {@link Clock} Supplier attached to the {@link Validator}. The
16+
* <p>
17+
* <i>Now</i> is defined by the {@code Clock} Supplier attached to the {@code Validator}. The
1818
* default clock defines the current time according to the virtual machine, applying the current
1919
* default time zone if needed.
20-
*
21-
* <p>The notion of present here is defined relatively to the type on which the constraint is used.
22-
* For instance, if the constraint is on a {@link Year}, present would mean the whole current year.
23-
*
24-
* <p>Supported types are:
25-
*
20+
* <p>
21+
* The notion of present here is defined relatively to the type on which the constraint is used.
22+
* For instance, if the constraint is on a {@code Year}, present would mean the whole current year.
23+
* <p>
24+
* Supported types are:
2625
* <ul>
2726
* <li>{@code java.util.Date}
2827
* <li>{@code java.util.Calendar}
@@ -37,8 +36,8 @@
3736
* <li>{@code java.time.YearMonth}
3837
* <li>{@code java.time.ZonedDateTime}
3938
* </ul>
40-
*
41-
* <p>{@code null} elements are considered valid.
39+
* <p>
40+
* {@code null} elements are considered valid.
4241
*/
4342
@Constraint
4443
@Documented

validator-constraints/src/main/java/io/avaje/validation/constraints/Length.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
/**
88
* The annotated string length must be between the specified boundaries (included).
9-
*
10-
* <p>Supported types are:
9+
* <p>
10+
* Supported types are:
1111
* <ul>
1212
* <li>{@code CharSequence} (length of character sequence is evaluated)
1313
* <li>{@code String} (length of character sequence is evaluated)
@@ -23,10 +23,17 @@
2323

2424
Class<?>[] groups() default {};
2525

26+
/** Return size the string must be higher or equal to */
2627
int min() default 0;
2728

29+
/** Return size the string must be lower or equal to */
2830
int max() default Integer.MAX_VALUE;
2931

32+
/**
33+
* Defines several {@link Length} annotations on the same element.
34+
*
35+
* @see Length
36+
*/
3037
@Target({ElementType.METHOD, ElementType.FIELD})
3138
@Retention(RetentionPolicy.RUNTIME)
3239
@Documented

0 commit comments

Comments
 (0)