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 <T> void |
notContainsNull(Iterable<T> param,
String paramName)
Fails if the input iterable contains null elements.
|
static <T> void |
notContainsNull(T[] param,
String paramName)
Fails if the input array has contains elements.
|
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 |
notOfType(Object param,
Class paramExpectedClass,
String paramName)
Fails if param is not of the expected type.
|
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 parameterparamName - The input parameter nameIllegalArgumentExceptionpublic static <T> void notContainsNull(Iterable<T> param, String paramName) throws IllegalArgumentException
T - The type parameterparam - The input parameterparamName - The input parameter nameIllegalArgumentExceptionpublic static <T> void notContainsNull(T[] param,
String paramName)
throws IllegalArgumentException
T - The type parameterparam - The input parameterparamName - The input parameter nameIllegalArgumentExceptionpublic static void notEqual(Object param, Object value, String paramName)
param - The input parametervalue - The input valueparamName - The input parameter namepublic 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.IllegalStateExceptionpublic static void notOfType(Object param, Class paramExpectedClass, String paramName) throws IllegalArgumentException
param - The input parameterparamExpectedClass - The expected type.paramName - The input parameter name.IllegalArgumentExceptionCopyright © 2023. All rights reserved.