Class Validate


  • public final class Validate
    extends Object
    • Method Detail

      • checkArgument

        public static void checkArgument​(boolean expression,
                                         @NotNull
                                         @NotNull String message)
                                  throws IllegalArgumentException
        Checks the specified expression
        Parameters:
        expression - to check
        message - to use in exception
        Throws:
        IllegalArgumentException - when false
      • checkState

        public static void checkState​(boolean expression)
        Checks whether the specified expression is true
        Parameters:
        expression - expression to checks
        Throws:
        IllegalStateException - if expression is false
      • checkState

        public static void checkState​(boolean expression,
                                      @NotNull
                                      @NotNull Object errorMessage)
        Checks whether the specified expression is true
        Parameters:
        expression - expression to checks
        errorMessage - message to use in exception
        Throws:
        IllegalStateException - if expression is false
      • checkState

        public static void checkState​(boolean expression,
                                      @NotNull
                                      @NotNull String messageTemplate,
                                      @Nullable
                                      @Nullable Object... messageArgs)
        Checks whether the specified expression is true
        Parameters:
        expression - expression to checks
        messageTemplate - to use in exception (using String.format(java.lang.String, java.lang.Object...) syntax
        messageArgs - arguments to use in messageTemplate
        Throws:
        IllegalArgumentException - if expression is false