public class InternalPreconditions extends Object
Constructor and Description |
---|
InternalPreconditions() |
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 errorMessage)
Ensures the truth of an expression involving one or more parameters to the calling method.
|
static void |
checkArgument(boolean expression,
String errorMessageTemplate,
Object... errorMessageArgs)
Ensures the truth of an expression involving one or more parameters to the calling method.
|
static void |
checkArraySize(int size)
Ensures that
size specifies a valid array size (i.e. |
static void |
checkArrayType(boolean expression,
Object errorMessage)
Ensures the truth of an expression that verifies array type.
|
static void |
checkCriticalArgument(boolean expression)
Ensures the truth of an expression involving one or more parameters to the calling method.
|
static void |
checkCriticalArgument(boolean expression,
Object errorMessage)
Ensures the truth of an expression involving one or more parameters to the calling method.
|
static void |
checkCriticalArgument(boolean expression,
String errorMessageTemplate,
Object... errorMessageArgs)
Ensures the truth of an expression involving one or more parameters to the calling method.
|
static void |
checkCriticalElement(boolean expression)
Ensures the truth of an expression involving existence of an element.
|
static void |
checkCriticalPositionIndexes(int start,
int end,
int size)
Ensures that
start and end specify a valid positions in an array, list
or string of size size , and are in order. |
static void |
checkElement(boolean expression)
Ensures the truth of an expression involving existence of an element.
|
static void |
checkElement(boolean expression,
Object errorMessage)
Ensures the truth of an expression involving existence of an element.
|
static void |
checkElementIndex(int index,
int size)
Ensures that
index specifies a valid element in an array, list or string of size
size . |
static void |
checkNotNull(Object reference,
Object errorMessage)
Ensures that an object reference passed as a parameter to the calling method is not null.
|
static <T> T |
checkNotNull(T reference)
Ensures that an object reference passed as a parameter to the calling method is not null.
|
static void |
checkPositionIndex(int index,
int size)
Ensures that
index specifies a valid position in an array, list or string of
size size . |
static void |
checkPositionIndexes(int start,
int end,
int size)
Ensures that
start and end specify a valid positions in an array, list
or string of size size , and are in order. |
static void |
checkState(boolean expression)
Ensures the truth of an expression involving the state of the calling instance, but not
involving any parameters to the calling method.
|
static void |
checkState(boolean expression,
Object errorMessage)
Ensures the truth of an expression involving the state of the calling instance, but not
involving any parameters to the calling method.
|
public static void checkArrayType(boolean expression, Object errorMessage)
public static void checkElement(boolean expression)
public static void checkElement(boolean expression, Object errorMessage)
public static void checkCriticalElement(boolean expression)
For cases where failing fast is pretty important and not failing early could cause bugs that are much harder to debug.
public static void checkArgument(boolean expression)
public static void checkArgument(boolean expression, Object errorMessage)
public static void checkArgument(boolean expression, String errorMessageTemplate, Object... errorMessageArgs)
public static void checkCriticalArgument(boolean expression)
For cases where failing fast is pretty important and not failing early could cause bugs that are much harder to debug.
public static void checkCriticalArgument(boolean expression, Object errorMessage)
For cases where failing fast is pretty important and not failing early could cause bugs that are much harder to debug.
public static void checkCriticalArgument(boolean expression, String errorMessageTemplate, Object... errorMessageArgs)
For cases where failing fast is pretty important and not failing early could cause bugs that are much harder to debug.
public static void checkState(boolean expression)
expression
- a boolean expressionIllegalStateException
- if expression
is falsepublic static void checkState(boolean expression, Object errorMessage)
public static <T> T checkNotNull(T reference)
public static void checkNotNull(Object reference, Object errorMessage)
public static void checkArraySize(int size)
size
specifies a valid array size (i.e. non-negative).public static void checkElementIndex(int index, int size)
index
specifies a valid element in an array, list or string of size
size
. An element index may range from zero, inclusive, to size
, exclusive.public static void checkPositionIndex(int index, int size)
index
specifies a valid position in an array, list or string of
size size
. A position index may range from zero to size
, inclusive.public static void checkPositionIndexes(int start, int end, int size)
start
and end
specify a valid positions in an array, list
or string of size size
, and are in order. A position index may range from zero to
size
, inclusive.public static void checkCriticalPositionIndexes(int start, int end, int size)
start
and end
specify a valid positions in an array, list
or string of size size
, and are in order. A position index may range from zero to
size
, inclusive.Copyright © 2016. All rights reserved.