public class ArgumentGuard extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
greaterThanOrEqualToZero(long param,
String paramName)
Fails if the input integer parameter is negative.
|
static void |
greaterThanZero(double param,
String paramName)
Fails if the input integer parameter is below or equal to 0.
|
static void |
greaterThanZero(long param,
String paramName)
Fails if the input integer parameter is smaller than 1.
|
static void |
isNull(Object param,
String paramName)
Fails if the input parameter is not null.
|
static void |
isValidState(boolean isValid,
String errMsg)
Fails if isValid is false.
|
static void |
notEqual(Object param,
Object value,
String paramName)
Fails if the input parameter equals the input value.
|
static void |
notNull(Object param,
String paramName)
Fails if the input parameter is null.
|
static void |
notNullOrEmpty(String param,
String paramName)
Fails if the input parameter string is null or empty.
|
static void |
notZero(long param,
String paramName)
Fails if the input integer parameter is equal to 0.
|
public static void notNull(Object param, String paramName) throws IllegalArgumentException
param - The input parameter.paramName - The input parameter name.IllegalArgumentExceptionpublic static void notEqual(Object param, Object value, String paramName)
param - The input parameter.value - The input value.paramName - The input parameter name.public static void notNullOrEmpty(String param, String paramName) throws IllegalArgumentException
param - The input parameter.paramName - The input parameter name.IllegalArgumentExceptionpublic static void isNull(Object param, String paramName) throws IllegalArgumentException
param - The input parameter.paramName - The input parameter name.IllegalArgumentExceptionpublic static void greaterThanOrEqualToZero(long param,
String paramName)
throws IllegalArgumentException
param - The input parameter.paramName - The input parameter name.IllegalArgumentExceptionpublic static void greaterThanZero(long param,
String paramName)
throws IllegalArgumentException
param - The input parameter.paramName - The input parameter name.IllegalArgumentExceptionpublic static void greaterThanZero(double param,
String paramName)
throws IllegalArgumentException
param - The input parameter.paramName - The input parameter name.IllegalArgumentExceptionpublic static void notZero(long param,
String paramName)
throws IllegalArgumentException
param - The input parameter.paramName - The input parameter name.IllegalArgumentExceptionpublic static void isValidState(boolean isValid,
String errMsg)
throws IllegalStateException
isValid - Whether the current state is valid.errMsg - A description of the error.IllegalStateExceptionCopyright © 2017. All rights reserved.