public final class Preconditions extends Object
Modifier and Type | Method and Description |
---|---|
static void |
checkArgument(boolean expression)
Ensures the truth of an expression involving one or more parameters to the calling method.
|
static void |
checkArgument(boolean expression,
Object message)
Ensures the truth of an expression involving one or more parameters to the calling method.
|
static void |
checkNotNull(Object reference)
Ensures that an object reference passed as a parameter to the calling method is not null.
|
static void |
checkNotNull(Object reference,
Object message)
Ensures that an object reference passed as a parameter to the calling method is not null.
|
public static void checkArgument(boolean expression, Object message)
expression
- a boolean expression.message
- the exception message to use if the check fails;
will be converted to a string using String.valueOf(Object)IllegalArgumentException
- if expression is false.public static void checkArgument(boolean expression)
expression
- a boolean expression.IllegalArgumentException
- if expression is false.public static void checkNotNull(Object reference, Object message)
reference
- an object reference.message
- the exception message to use if the check fails;
will be converted to a string using String.valueOf(Object)IllegalArgumentException
- if reference is null
.public static void checkNotNull(Object reference)
reference
- an object reference.IllegalArgumentException
- if reference is null
.Copyright © 2007–2022. All rights reserved.