Class RestrictedClientValidator
java.lang.Object
io.github.marcopaglio.booking.validator.restricted.RestrictedClientValidator
- All Implemented Interfaces:
ClientValidator
An implementation of validator for client entities that verifies if parameters are not null
or empty string neither they contain non-alphabetic characters, and fixes them if possible.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvalidateFirstName(String firstName) Checks if firstName is valid as name for a client entity, and returns a fixed and valid alternative for it.validateLastName(String lastName) Checks if lastName is valid as surname for a client entity, and returns a fixed and valid alternative for it.
-
Constructor Details
-
RestrictedClientValidator
public RestrictedClientValidator()
-
-
Method Details
-
validateFirstName
Checks if firstName is valid as name for a client entity, and returns a fixed and valid alternative for it.- Specified by:
validateFirstNamein interfaceClientValidator- Parameters:
firstName- the string parameter to evaluate.- Returns:
- a fixed and valid
StringoffirstName. - Throws:
IllegalArgumentException- iffirstNameis null or not valid.
-
validateLastName
Checks if lastName is valid as surname for a client entity, and returns a fixed and valid alternative for it.- Specified by:
validateLastNamein interfaceClientValidator- Parameters:
lastName- the string parameter to evaluate.- Returns:
- a fixed and valid
StringoflastName. - Throws:
IllegalArgumentException- iflastNameis null or not valid.
-