Class JKValidationUtil

java.lang.Object
com.jk.core.util.JKValidationUtil

public class JKValidationUtil extends Object
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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static 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
    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
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JKValidationUtil

      public JKValidationUtil()
  • Method Details

    • isBoolean

      public static boolean isBoolean(String param)
      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

      public static boolean isDouble(String txt)
      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

      public static boolean isEmpty(String str)
      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

      public static boolean isFloat(String txt)
      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

      public static boolean isInt(String str)
      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

      public static boolean isInteger(String txt)
      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

      public static boolean isUpperCase(String txt)
      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

      public static boolean isAnyEmpty(String... data)
      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

      public static boolean isEmpty(Collection<?> list)
      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

      public static void validateNull(String name, Object object)
      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.