com.ninja_squad.dbsetup.util
Class Preconditions

java.lang.Object
  extended by com.ninja_squad.dbsetup.util.Preconditions

public final class Preconditions
extends java.lang.Object

Utility class to help verifying preconditions


Method Summary
static void checkArgument(boolean condition, java.lang.String message)
          Throws an IllegalARgumentException with the given message if the given condition is false.
static void checkNotNull(java.lang.Object argument, java.lang.String message)
          Throws a NullPointerException with the given message if the given argument is null.
static void checkState(boolean condition, java.lang.String message)
          Throws an IllegalStateException with the given message if the given condition is false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

checkNotNull

public static void checkNotNull(java.lang.Object argument,
                                java.lang.String message)
                         throws java.lang.NullPointerException
Throws a NullPointerException with the given message if the given argument is null.

Parameters:
argument - the argument to check for null
message - the message of the thrown NullPointerException
Throws:
java.lang.NullPointerException - if argument is null.

checkState

public static void checkState(boolean condition,
                              java.lang.String message)
                       throws java.lang.IllegalStateException
Throws an IllegalStateException with the given message if the given condition is false.

Parameters:
condition - the condition to check
message - the message of the thrown IllegalStateException
Throws:
java.lang.IllegalStateException - if the condition is false.

checkArgument

public static void checkArgument(boolean condition,
                                 java.lang.String message)
                          throws java.lang.IllegalStateException
Throws an IllegalARgumentException with the given message if the given condition is false.

Parameters:
condition - the condition to check
message - the message of the thrown IllegalArgumentException
Throws:
java.lang.IllegalArgumentException - if the condition is false.
java.lang.IllegalStateException