Class Preconditions


  • public final class Preconditions
    extends java.lang.Object
    Internal utility class.

    It is not a part of the API!

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Preconditions()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void checkArgument​(boolean expression, java.lang.String errorMessage)
      Checks the given argument and throws an exception if not met.
      static void checkArgument​(boolean expression, java.lang.String errorMessageTemplate, java.lang.Object... errorMessageArgs)
      Checks the given argument and throws an exception if not met.
      • Methods inherited from class java.lang.Object

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

      • Preconditions

        private Preconditions()
    • Method Detail

      • checkArgument

        public static void checkArgument​(boolean expression,
                                         java.lang.String errorMessage)
        Checks the given argument and throws an exception if not met.
        Parameters:
        expression - the expression that has to be true
        errorMessage - the exception message to be thrown
        Throws:
        java.lang.IllegalArgumentException - if the expression is false.
      • checkArgument

        public static void checkArgument​(boolean expression,
                                         java.lang.String errorMessageTemplate,
                                         java.lang.Object... errorMessageArgs)
        Checks the given argument and throws an exception if not met.
        Parameters:
        expression - the expression that has to be true
        errorMessageTemplate - the exception message template (format String.format(String, Object...)) to be thrown
        errorMessageArgs - the exception message arguments
        Throws:
        java.lang.IllegalArgumentException - if the expression is false.