Package io.github.multiform_validator
Class Validator
java.lang.Object
io.github.multiform_validator.Validator
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Checks if the given string contains only ASCII characters.static boolean
Checks if the given string is a valid Base64 encoded string.static boolean
Checks if the given string is a valid CEP (Brazilian postal code).static boolean
Checks if the given string is a valid date.static boolean
Checks if the given string is a valid decimal number.static boolean
Checks if the given string is a valid email address.static boolean
isMACAddress
(String macAddress) Checks if the given string is a valid MAC address.static boolean
Checks if the given string is a valid MD5 hash.static boolean
Checks if the given string is a valid number.static boolean
isPort
(int port) Checks if the given port number is valid.static boolean
Checks if the given string is a valid port number.static boolean
isPostalCode
(String postalCode) Checks if the given string is a valid postal code.static boolean
Checks 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
-