Apply Constraints

WARNING - TOPIC NOT WRITTEN - TOPIC ID: 2386

This topic has not yet been written. The content below is from the topic description.
1.2. Applying constraints Open the project in the IDE of your choice and have a look at the class Car: Example 1.3. Class Car annotated with constraints package com.mycompany; import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; public class Car {     @NotNull     private String manufacturer;     @NotNull     @Size(min = 2, max = 14)     private String licensePlate;     @Min(2)     private int seatCount;          public Car(String manufacturer, String licencePlate, int seatCount) {         this.manufacturer = manufacturer;         this.licensePlate = licencePlate;         this.seatCount = seatCount;     }     //getters and setters ... } @NotNull, @Size and @Min are so-called constraint annotations, that we use to declare constraints, which shall be applied to the fields of a Car instance: manufacturer shall never be null licensePlate shall never be null and must be between 2 and 14 characters long seatCount shall be at least 2.