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
-
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:
validateFirstName
in interfaceClientValidator
- Parameters:
firstName
- the string parameter to evaluate.- Returns:
- a fixed and valid
String
offirstName
. - Throws:
IllegalArgumentException
- iffirstName
is 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:
validateLastName
in interfaceClientValidator
- Parameters:
lastName
- the string parameter to evaluate.- Returns:
- a fixed and valid
String
oflastName
. - Throws:
IllegalArgumentException
- iflastName
is null or not valid.
-