Skip to content
Ameen Abozaid
Planned lessonJNR-014-L02

Built-in constraints

  • Lesson 2 of 6
  • Junior
On This Lesson 4 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

pick the right standard constraint.

Planned topics

  • @NotNull (not null), @NotBlank (text with a visible character), @NotEmpty (not empty collection or text).
  • @Size(min, max), @Min, @Max, @Positive, @PositiveOrZero, @DecimalMin.
  • @Pattern(regexp=...), @Email, @Past, @Future.
  • Constraints on nested objects and elements need @Valid on the field.
  • Null is treated as valid by most constraints except @NotNull, @NotBlank, @NotEmpty.
Draft outline details

Demonstration

a table of the constraints with one example field each.

Check your understanding

Which for a required product name?

Show answer

@NotBlank.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.