public final class Preconditions extends Object
Modifier and Type | Method and Description |
---|---|
static void |
checkArgument(boolean valid,
String message) |
static <T> T |
checkNotNull(T o,
String name) |
static void |
checkState(boolean valid,
String message) |
public static <T> T checkNotNull(T o, String name) throws NullPointerException
o
- the param to checkname
- the name of the param for the error messageNullPointerException
- if o is nullpublic static void checkArgument(boolean valid, String message) throws IllegalArgumentException
valid
- whether the argument is validmessage
- error message if the argument is not validIllegalArgumentException
- if !validpublic static void checkState(boolean valid, String message) throws IllegalStateException
valid
- whether the argument is validmessage
- error message if the argument is not validIllegalStateException
- if !validCopyright © 2015. All rights reserved.