Class Validate

java.lang.Object
com.amilesend.client.util.Validate

public final class Validate extends Object
Utility methods used to validate method input.
  • Method Details

    • notBlank

      public static void notBlank(CharSequence chars, String message)
      Throws an exception if the given chars is blank.
      Parameters:
      chars - the character sequence to validate
      message - the message to include in the exception thrown
      Throws:
      NullPointerException - if the char sequence is null
      IllegalArgumentException - if the char sequence is not blank
    • notEmpty

      public static void notEmpty(Collection<?> collection, String message)
      Throws an exception if the given collection is empty.
      Parameters:
      collection - the collection to validate
      message - the message to include in the exception thrown
      Throws:
      NullPointerException - if the collection is null
      IllegalArgumentException - if the collection is not blank
    • notEmpty

      public static void notEmpty(Map<?,?> map, String message)
      Throws an exception if the given map is empty.
      Parameters:
      map - the map to validate
      message - the message to include in the exception thrown
      Throws:
      NullPointerException - if the map is null
      IllegalArgumentException - if the map is not blank
    • isTrue

      public static void isTrue(boolean exp, String message)
      Throws an exception if the given expression is false.
      Parameters:
      exp - the boolean expression
      message - the message to include in the exception thrown
      Throws:
      IllegalArgumentException - if the expression is false
    • notNull

      public static void notNull(Object obj, String message)
      Throws an exception if the given object is null.
      Parameters:
      obj - the object
      message - the message to include in the exception thrown
      Throws:
      NullPointerException - if the object is null