类 Assert

java.lang.Object
com.dinstone.vertx.web.util.Assert

public final class Assert
extends Object
  • 方法详细资料

    • always

      public static void always​(String message)
      Will always throw and IlligalArgumentException
      参数:
      message - fail message aka: "forgot to implement this"
    • isFalse

      public static void isFalse​(boolean test, String message)
      Tests if condition is false
      参数:
      test - must be false
      message - to return in exception
      抛出:
      IllegalArgumentException - if test is true
    • isTrue

      public static void isTrue​(boolean test, String message)
      Tests if condition is true
      参数:
      test - must be ture
      message - to return in exception
      抛出:
      IllegalArgumentException - if test is false
    • isNull

      public static <T> void isNull​(T test, String message)
      Tests if object is null
      类型参数:
      T - object type
      参数:
      test - must be null
      message - to return in exception
      抛出:
      IllegalArgumentException - if object != null
    • notNull

      public static <T> void notNull​(T test, String message)
      Tests if object is != null
      类型参数:
      T - object type
      参数:
      test - must not be null
      message - to return in exception
      抛出:
      IllegalArgumentException - if object == null
    • notNullOrEmptyTrimmed

      public static void notNullOrEmptyTrimmed​(String value, String message)
      Tests if String is null or empty when trimmed
      参数:
      value - must be non empty string
      message - to return in exception
      抛出:
      IllegalArgumentException - if value == null, value == "" or value.trim() == ""
    • notNullOrEmpty

      public static <T> void notNullOrEmpty​(Collection<T> list, String message)
      Tests if list is null or empty
      类型参数:
      T - object type
      参数:
      list - must be have at least one element
      message - to return in exception
      抛出:
      IllegalArgumentException - if list == null or list.size() == 0
    • notNullOrEmpty

      public static <T> void notNullOrEmpty​(Set<T> set, String message)
      Tests if list is null or empty
      类型参数:
      T - object type
      参数:
      set - must be have at least one element
      message - to return in exception
      抛出:
      IllegalArgumentException - if list == null or list.size() == 0
    • notNullOrEmpty

      public static <T> void notNullOrEmpty​(T[] array, String message)
      Tests if list is null or empty
      类型参数:
      T - object type
      参数:
      array - must be have at least one element
      message - to return in exception
      抛出:
      IllegalArgumentException - if list == null or list.size() == 0
    • notNullOrEmpty

      public static <T,​ K> void notNullOrEmpty​(Map<T,​K> map, String message)
      Tests if map is null or empty
      类型参数:
      T - object type
      K - value type
      参数:
      map - must be have at least one element
      message - to return in exception
      抛出:
      IllegalArgumentException - if list == null or list.size() == 0
    • isNullOrEmpty

      public static <T> void isNullOrEmpty​(List<T> list, String message)
      Tests if list is null or empty
      类型参数:
      T - object type
      参数:
      list - must be null or empty
      message - to return in exception
      抛出:
      IllegalArgumentException - if list != null or list.size() greater than 0
    • isNullOrEmpty

      public static <T> void isNullOrEmpty​(Set<T> set, String message)
      Tests if set is null or empty
      类型参数:
      T - object type
      参数:
      set - must be null or empty
      message - to return in exception
      抛出:
      IllegalArgumentException - if list != null or list.size() greater than 0
    • isNullOrEmpty

      public static <T> void isNullOrEmpty​(T[] array, String message)
      Tests if array is null or empty
      类型参数:
      T - object type
      参数:
      array - must be null or empty
      message - to return in exception
      抛出:
      IllegalArgumentException - if list != null or list.size() greater than 0
    • isNullOrEmpty

      public static <T,​ K> void isNullOrEmpty​(Map<T,​K> map, String message)
      Tests if map is null or empty
      类型参数:
      T - object type
      K - value type
      参数:
      map - must be null or empty
      message - to return in exception
      抛出:
      IllegalArgumentException - if list != null or list.size() greater than 0