public class Arguments extends Object
Helper class to perform extended checks on arguments analogous to
Objects.requireNonNull(Object, String)
.
Constructor and Description |
---|
Arguments() |
Modifier and Type | Method and Description |
---|---|
static void |
require(boolean condition,
String message)
Checks that the specified condition is fulfilled and throws a customized
IllegalArgumentException if it
is false . |
static void |
requireInRange(int number,
int min,
int max,
String message)
Checks that the specified number is within the specified minimum and maximum range (inclusively) and throws a
customized
IllegalArgumentException if not. |
public static void require(boolean condition, String message)
Checks that the specified condition is fulfilled and throws a customized IllegalArgumentException
if it
is false
.
condition
- condition which must be fulfilledmessage
- detail message to be used in the event that a IllegalArgumentException
is thrownpublic static void requireInRange(int number, int min, int max, String message)
Checks that the specified number is within the specified minimum and maximum range (inclusively) and throws a
customized IllegalArgumentException
if not.
number
- value to checkmin
- minimum allowed valuemax
- maximum allowed valuemessage
- detail message to be used in the event that a IllegalArgumentException
is thrownCopyright © 2014. All Rights Reserved.