Card 05/ 06

ExerciseDifficulty: Advanced1 min

Add a Constraint

RideRequest needs a third field, vehicleType, that must be one of "sedan", "suv" or "van". Which annotation constrains a String to match a pattern, and what would the pattern look like?

See the answer
java
@Pattern(regexp = "^(sedan|suv|van)$", message = "Invalid vehicle type")
String vehicleType