From 9fa26a0cb8532af2162f27643642d984cb7e5622 Mon Sep 17 00:00:00 2001 From: Mechite Date: Tue, 16 Sep 2025 00:24:03 +0100 Subject: [PATCH 1/4] Reformat & correct the JavaDoc of all constraints Signed-off-by: Mechite --- .../validation/constraints/AssertFalse.java | 7 +++-- .../validation/constraints/AssertTrue.java | 7 +++-- .../validation/constraints/Constraint.java | 3 +- .../validation/constraints/DecimalMax.java | 14 ++++----- .../validation/constraints/DecimalMin.java | 14 ++++----- .../avaje/validation/constraints/Digits.java | 16 +++++++--- .../avaje/validation/constraints/Email.java | 8 ++--- .../avaje/validation/constraints/Future.java | 13 ++++---- .../constraints/FutureOrPresent.java | 19 ++++++------ .../avaje/validation/constraints/Length.java | 11 +++++-- .../io/avaje/validation/constraints/Max.java | 31 +++++++++++-------- .../io/avaje/validation/constraints/Min.java | 31 +++++++++++-------- .../validation/constraints/Negative.java | 21 ++++++------- .../constraints/NegativeOrZero.java | 17 +++++----- .../validation/constraints/NotBlank.java | 4 +-- .../validation/constraints/NotEmpty.java | 12 +++++-- .../io/avaje/validation/constraints/Past.java | 2 +- .../validation/constraints/PastOrPresent.java | 16 +++------- .../validation/constraints/RegexFlag.java | 1 + 19 files changed, 133 insertions(+), 114 deletions(-) diff --git a/validator-constraints/src/main/java/io/avaje/validation/constraints/AssertFalse.java b/validator-constraints/src/main/java/io/avaje/validation/constraints/AssertFalse.java index e9d69ef1..c25b778a 100644 --- a/validator-constraints/src/main/java/io/avaje/validation/constraints/AssertFalse.java +++ b/validator-constraints/src/main/java/io/avaje/validation/constraints/AssertFalse.java @@ -11,9 +11,10 @@ import java.lang.annotation.Target; /** - * The annotated element must be false. Supported types are {@code boolean} and {@code Boolean}. - * - *

{@code null} elements are considered valid. + * The annotated element must be false. + * Supported types are {@code boolean} and {@code Boolean}. + *

+ * {@code null} elements are considered valid. * * @author Emmanuel Bernard */ diff --git a/validator-constraints/src/main/java/io/avaje/validation/constraints/AssertTrue.java b/validator-constraints/src/main/java/io/avaje/validation/constraints/AssertTrue.java index 00cfd150..95a89b81 100644 --- a/validator-constraints/src/main/java/io/avaje/validation/constraints/AssertTrue.java +++ b/validator-constraints/src/main/java/io/avaje/validation/constraints/AssertTrue.java @@ -11,9 +11,10 @@ import java.lang.annotation.Target; /** - * The annotated element must be true. Supported types are {@code boolean} and {@code Boolean}. - * - *

{@code null} elements are considered valid. + * The annotated element must be true. + * Supported types are {@code boolean} and {@code Boolean}. + *

+ * {@code null} elements are considered valid. * * @author Emmanuel Bernard */ diff --git a/validator-constraints/src/main/java/io/avaje/validation/constraints/Constraint.java b/validator-constraints/src/main/java/io/avaje/validation/constraints/Constraint.java index f7c518d7..a3e6a14b 100644 --- a/validator-constraints/src/main/java/io/avaje/validation/constraints/Constraint.java +++ b/validator-constraints/src/main/java/io/avaje/validation/constraints/Constraint.java @@ -7,7 +7,8 @@ import java.lang.annotation.Target; /** - * Marks an annotation as a Constraint class. Only annotations marked with Constraint are composable + * Marks an annotation as a constraint class. + * Only annotations marked with {@code @Constraint} are composable. */ @Retention(CLASS) @Target({ANNOTATION_TYPE}) diff --git a/validator-constraints/src/main/java/io/avaje/validation/constraints/DecimalMax.java b/validator-constraints/src/main/java/io/avaje/validation/constraints/DecimalMax.java index 1abad855..5f034c18 100644 --- a/validator-constraints/src/main/java/io/avaje/validation/constraints/DecimalMax.java +++ b/validator-constraints/src/main/java/io/avaje/validation/constraints/DecimalMax.java @@ -14,20 +14,18 @@ /** * The annotated element must be a number whose value must be lower or equal to the specified * maximum. - * - *

Supported types are: - * + *

+ * Supported types are: *

- * * Note that {@code double} and {@code float} are not supported due to rounding errors (some * providers might provide some approximative support). - * - *

{@code null} elements are considered valid. + *

+ * {@code null} elements are considered valid. * * @author Emmanuel Bernard */ @@ -52,8 +50,8 @@ /** * Specifies whether the specified maximum is inclusive or exclusive. By default, it is inclusive. * - * @return {@code true} if the value must be lower or equal to the specified maximum, {@code - * false} if the value must be lower + * @return {@code true} if the value must be lower or equal to the specified maximum, + * {@code false} if the value must be lower * @since 1.1 */ boolean inclusive() default true; diff --git a/validator-constraints/src/main/java/io/avaje/validation/constraints/DecimalMin.java b/validator-constraints/src/main/java/io/avaje/validation/constraints/DecimalMin.java index 75e41f2d..0627484c 100644 --- a/validator-constraints/src/main/java/io/avaje/validation/constraints/DecimalMin.java +++ b/validator-constraints/src/main/java/io/avaje/validation/constraints/DecimalMin.java @@ -20,20 +20,18 @@ /** * The annotated element must be a number whose value must be higher or equal to the specified * minimum. - * - *

Supported types are: - * + *

+ * Supported types are: *

- * * Note that {@code double} and {@code float} are not supported due to rounding errors (some * providers might provide some approximative support). - * - *

{@code null} elements are considered valid. + *

+ * {@code null} elements are considered valid. * * @author Emmanuel Bernard */ @@ -58,8 +56,8 @@ /** * Specifies whether the specified maximum is inclusive or exclusive. By default, it is inclusive. * - * @return {@code true} if the value must be lower or equal to the specified maximum, {@code - * false} if the value must be lower + * @return {@code true} if the value must be lower or equal to the specified maximum, + * {@code false} if the value must be lower * @since 1.1 */ boolean inclusive() default true; diff --git a/validator-constraints/src/main/java/io/avaje/validation/constraints/Digits.java b/validator-constraints/src/main/java/io/avaje/validation/constraints/Digits.java index fe9d77ec..41b79517 100644 --- a/validator-constraints/src/main/java/io/avaje/validation/constraints/Digits.java +++ b/validator-constraints/src/main/java/io/avaje/validation/constraints/Digits.java @@ -15,17 +15,16 @@ /** * The annotated element must be a number within accepted range. - * - *

Supported types are: - * + *

+ * Supported types are: *

- * - *

{@code null} elements are considered valid. + *

+ * {@code null} elements are considered valid. * * @author Emmanuel Bernard */ @@ -38,10 +37,17 @@ Class[] groups() default {}; + /** @return maximum number of integral digits accepted for this number */ int integer(); + /** @return maximum number of fractional digits accepted for this number */ int fraction() default 0; + /** + * Defines several {@link Digits} annotations on the same element. + * + * @see Digits + */ @Target({ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @Documented diff --git a/validator-constraints/src/main/java/io/avaje/validation/constraints/Email.java b/validator-constraints/src/main/java/io/avaje/validation/constraints/Email.java index 931ee6a3..4b7ead39 100644 --- a/validator-constraints/src/main/java/io/avaje/validation/constraints/Email.java +++ b/validator-constraints/src/main/java/io/avaje/validation/constraints/Email.java @@ -13,10 +13,10 @@ /** * The string has to be a well-formed email address. Exact semantics of what makes up a valid email - * address are left to the provided Email Annotation ValidationAdapter providers. Accepts {@code - * CharSequence}. - * - *

{@code null} elements are considered valid. + * address are left to the provided Email Annotation ValidationAdapter providers. + *

+ * Accepts {@code CharSequence}. + * {@code null} elements are considered valid. */ @Constraint @Documented diff --git a/validator-constraints/src/main/java/io/avaje/validation/constraints/Future.java b/validator-constraints/src/main/java/io/avaje/validation/constraints/Future.java index 414cf7be..f097ad62 100644 --- a/validator-constraints/src/main/java/io/avaje/validation/constraints/Future.java +++ b/validator-constraints/src/main/java/io/avaje/validation/constraints/Future.java @@ -13,13 +13,12 @@ /** * The annotated element must be an instant, date or time in the future. - * - *

Now is defined by the {@link Clock} Supplier attached to the {@link Validator}. The + *

+ * Now is defined by the {@code Clock} Supplier attached to the {@code Validator}. The * default clock defines the current time according to the virtual machine, applying the current * default time zone if needed. - * - *

Supported types are: - * + *

+ * Supported types are: *

- * - *

{@code null} elements are considered valid. + *

+ * {@code null} elements are considered valid. */ @Constraint @Documented diff --git a/validator-constraints/src/main/java/io/avaje/validation/constraints/FutureOrPresent.java b/validator-constraints/src/main/java/io/avaje/validation/constraints/FutureOrPresent.java index 1072b137..d78b4e37 100644 --- a/validator-constraints/src/main/java/io/avaje/validation/constraints/FutureOrPresent.java +++ b/validator-constraints/src/main/java/io/avaje/validation/constraints/FutureOrPresent.java @@ -13,16 +13,15 @@ /** * The annotated element must be an instant, date or time in the present or in the future. - * - *

Now is defined by the {@link Clock} Supplier attached to the {@link Validator}. The + *

+ * Now is defined by the {@code Clock} Supplier attached to the {@code Validator}. The * default clock defines the current time according to the virtual machine, applying the current * default time zone if needed. - * - *

The notion of present here is defined relatively to the type on which the constraint is used. - * For instance, if the constraint is on a {@link Year}, present would mean the whole current year. - * - *

Supported types are: - * + *

+ * The notion of present here is defined relatively to the type on which the constraint is used. + * For instance, if the constraint is on a {@code Year}, present would mean the whole current year. + *

+ * Supported types are: *

- * - *

{@code null} elements are considered valid. + *

+ * {@code null} elements are considered valid. */ @Constraint @Documented diff --git a/validator-constraints/src/main/java/io/avaje/validation/constraints/Length.java b/validator-constraints/src/main/java/io/avaje/validation/constraints/Length.java index cbb3aa31..04207d46 100644 --- a/validator-constraints/src/main/java/io/avaje/validation/constraints/Length.java +++ b/validator-constraints/src/main/java/io/avaje/validation/constraints/Length.java @@ -6,8 +6,8 @@ /** * The annotated string length must be between the specified boundaries (included). - * - *

Supported types are: + *

+ * Supported types are: *