public final class Preconditions extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
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 . |
public static void checkNotNull(java.lang.Object argument, java.lang.String message) throws java.lang.NullPointerException
null
.argument
- the argument to check for null
message
- the message of the thrown NullPointerExceptionjava.lang.NullPointerException
- if argument is null
.public static void checkState(boolean condition, java.lang.String message) throws java.lang.IllegalStateException
false
.condition
- the condition to checkmessage
- the message of the thrown IllegalStateExceptionjava.lang.IllegalStateException
- if the condition is false
.public static void checkArgument(boolean condition, java.lang.String message) throws java.lang.IllegalStateException
false
.condition
- the condition to checkmessage
- the message of the thrown IllegalArgumentExceptionjava.lang.IllegalArgumentException
- if the condition is false
.java.lang.IllegalStateException