Package com.jk.core.util
Class JKValidationUtil
java.lang.Object
com.jk.core.util.JKValidationUtil
This class is a utility class used for performing various validation checks
on strings and objects.
- Version:
- 1.0
- Author:
- Dr. Jalal H. Kiswani
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
isAnyEmpty
(String... data) This method checks if any of the provided strings are empty.static boolean
This method checks if the provided string represents a boolean value.static boolean
This method checks if the provided string can be parsed as a double.static boolean
This method checks if the provided string is empty.static boolean
isEmpty
(Collection<?> list) This method checks if a collection is null or empty.static boolean
This method checks if the provided string can be parsed as a float.static boolean
This method checks if the provided string can be parsed as an integer.static boolean
This method checks if the provided string can be parsed as an integer.static boolean
isUpperCase
(String txt) This method checks if the provided string is entirely in upper-case.static void
validateNull
(String name, Object object) This method validates that an object is not null, throwing an exception if it is.
-
Constructor Details
-
JKValidationUtil
public JKValidationUtil()
-
-
Method Details
-
isBoolean
This method checks if the provided string represents a boolean value.- Parameters:
param
- Specifies the string to be checked.- Returns:
- true, if the string represents a boolean value, false otherwise.
-
isDouble
This method checks if the provided string can be parsed as a double.- Parameters:
txt
- Specifies the string to be checked.- Returns:
- true, if the string can be parsed as a double, false otherwise.
-
isEmpty
This method checks if the provided string is empty.- Parameters:
str
- Specifies the string to be checked.- Returns:
- true, if the string is null or contains only whitespace, false otherwise.
-
isFloat
This method checks if the provided string can be parsed as a float.- Parameters:
txt
- Specifies the string to be checked.- Returns:
- true, if the string can be parsed as a float, false otherwise.
-
isInt
This method checks if the provided string can be parsed as an integer.- Parameters:
str
- Specifies the string to be checked.- Returns:
- true, if the string can be parsed as an integer, false otherwise.
-
isInteger
This method checks if the provided string can be parsed as an integer.- Parameters:
txt
- Specifies the string to be checked.- Returns:
- true, if the string can be parsed as an integer, false otherwise.
-
isUpperCase
This method checks if the provided string is entirely in upper-case.- Parameters:
txt
- Specifies the string to be checked.- Returns:
- true, if all characters in the string are upper-case, false otherwise.
-
isAnyEmpty
This method checks if any of the provided strings are empty.- Parameters:
data
- Specifies the strings to be checked.- Returns:
- true, if at least one of the strings is empty, false otherwise.
-
isEmpty
This method checks if a collection is null or empty.- Parameters:
list
- Specifies the collection to be checked.- Returns:
- true, if the collection is null or empty, false otherwise.
-
validateNull
This method validates that an object is not null, throwing an exception if it is.- Parameters:
name
- Specifies the name or identifier of the object being validated.object
- Specifies the object to be validated.
-