Skip to content

Commit a1926d5

Browse files
add javadoc for method required()
1 parent 1aaeba3 commit a1926d5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

app/src/main/java/hexlet/code/schemas/BaseSchema.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ public final boolean isValid(T value) {
2626
.allMatch(t -> t.test(value));
2727
}
2828

29+
/**
30+
* Marks the schema as required, ensuring that the value being validated is not null.
31+
* <p>
32+
* This method adds a "required" validation to the schema, which checks that the provided value
33+
* is not {@code null}. If the validation fails, the schema will indicate an error.
34+
* </p>
35+
*
36+
* @return the current {@code BaseSchema} instance for method chaining.
37+
*/
2938
public BaseSchema required() {
3039
addValidation("required", Objects::nonNull);
3140
return this;

0 commit comments

Comments
 (0)