Package io.github.multiform_validator
Class Validator
java.lang.Object
io.github.multiform_validator.Validator
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanChecks if the given string contains only ASCII characters.static booleanChecks if the given string is a valid Base64 encoded string.static booleanChecks if the given string is a valid CEP (Brazilian postal code).static booleanChecks if the given string is a valid date.static booleanChecks if the given string is a valid decimal number.static booleanChecks if the given string is a valid email address.static booleanisMACAddress(String macAddress) Checks if the given string is a valid MAC address.static booleanChecks if the given string is a valid MD5 hash.static booleanChecks if the given string is a valid number.static booleanisPort(int port) Checks if the given port number is valid.static booleanChecks if the given string is a valid port number.static booleanisPostalCode(String postalCode) Checks if the given string is a valid postal code.static booleanChecks if the given string is a valid time in the format "HH:mm:ss" or "HH:mm:ss a".
-
Method Details
-
isAscii
Checks if the given string contains only ASCII characters.- Parameters:
value- the string to be checked- Returns:
- true if the string contains only ASCII characters, false otherwise
- Throws:
IllegalArgumentException- if the input value is null or empty
-
isBase64
Checks if the given string is a valid Base64 encoded string.- Parameters:
value- the string to be checked- Returns:
- true if the string is a valid Base64 encoded string, false otherwise
- Throws:
IllegalArgumentException- if the input value is null or empty
-
isCEP
Checks if the given string is a valid CEP (Brazilian postal code).- Parameters:
cep- the string to be checked- Returns:
- true if the string is a valid CEP, false otherwise
-
isDate
Checks if the given string is a valid date. The date can be in the following formats:- Parameters:
dateStr- the string to be checked- Returns:
- true if the string is a valid date, false otherwise
-
isDecimal
Checks if the given string is a valid decimal number.- Parameters:
value- the string to be checked- Returns:
- true if the string is a valid decimal number, false otherwise
- Throws:
IllegalArgumentException- if the input value is null or empty
-
isEmail
Checks if the given string is a valid email address.- Parameters:
email- the string to be checked- Returns:
- true if the string is a valid email address, false otherwise
- Throws:
NullPointerException- if the email is null
-
isMACAddress
Checks if the given string is a valid MAC address.- Parameters:
macAddress- the string to be checked- Returns:
- true if the string is a valid MAC address, false otherwise
- Throws:
IllegalArgumentException- if the input value is null or empty
-
isMD5
Checks if the given string is a valid MD5 hash.- Parameters:
value- the string to be checked- Returns:
- true if the string is a valid MD5 hash, false otherwise
- Throws:
IllegalArgumentException- if the input value is null or empty
-
isNumber
Checks if the given string is a valid number.- Parameters:
value- the string to be checked- Returns:
- true if the string is a valid number, false otherwise
- Throws:
IllegalArgumentException- if the input value is null or empty
-
isPort
public static boolean isPort(int port) Checks if the given port number is valid.- Parameters:
port- the port number to be checked- Returns:
- true if the port number is valid, false otherwise
-
isPort
Checks if the given string is a valid port number.- Parameters:
port- the string to be checked- Returns:
- true if the string is a valid port number, false otherwise
- Throws:
IllegalArgumentException- if the input value is null or empty
-
isPostalCode
Checks if the given string is a valid postal code.- Parameters:
postalCode- the string to be checked- Returns:
- true if the string is a valid postal code, false otherwise
- Throws:
IllegalArgumentException- if the input value is null or empty
-
isTime
Checks if the given string is a valid time in the format "HH:mm:ss" or "HH:mm:ss a".- Parameters:
time- the string to be checked- Returns:
- true if the string is a valid time, false otherwise
- Throws:
IllegalArgumentException- if the input value is null or empty
-