Class RestrictedReservationValidator
java.lang.Object
io.github.marcopaglio.booking.validator.restricted.RestrictedReservationValidator
- All Implemented Interfaces:
ReservationValidator
An implementation of validator for reservation entities that verifies if parameters are not
null neither date string contains non-valid characters, or are in a non-valid format
or out of range.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvalidateClientId
(UUID clientId) Checks if clientId is a not null identifier for the creation of a reservation entity, and returns it.validateDate
(String stringDate) Checks if stringDate is valid as date for a reservation entity, and returns it.
-
Constructor Details
-
RestrictedReservationValidator
public RestrictedReservationValidator()
-
-
Method Details
-
validateClientId
Checks if clientId is a not null identifier for the creation of a reservation entity, and returns it.- Specified by:
validateClientId
in interfaceReservationValidator
- Parameters:
clientId
- the associated client identifier to evaluate.- Returns:
- a valid
UUID
ofclientId
. - Throws:
IllegalArgumentException
- ifclientId
is null.
-
validateDate
Checks if stringDate is valid as date for a reservation entity, and returns it.- Specified by:
validateDate
in interfaceReservationValidator
- Parameters:
stringDate
- the string date to evaluate.- Returns:
- a valid
LocalDate
ofdate
. - Throws:
IllegalArgumentException
- ifstringDate
is null, or it contains non-valid characters, or its format is not valid, or it is out of range.
-