Package org.orbisgis.commons.utilities
Class CheckUtils
- java.lang.Object
-
- org.orbisgis.commons.utilities.CheckUtils
-
public class CheckUtils extends Object
Utility class for checking values, parameters ...- Author:
- Sylvain PALOMINOS (Lab-STICC UBS 2020)
-
-
Constructor Summary
Constructors Constructor Description CheckUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcheckNotEmpty(Object[] array)Check that the given array is not empty.static voidcheckNotEmpty(Object[] array, String message)Check that the given array is not empty.static voidcheckNotEmpty(Collection<?> value)Check that the givenCollectionis not empty.static voidcheckNotEmpty(Collection<?> value, String message)Check that the givenCollectionis not empty.static voidcheckNotNull(Object value)Check that the given value is not null.static voidcheckNotNull(Object value, String message)Check that the given value is not null.
-
-
-
Method Detail
-
checkNotNull
public static void checkNotNull(Object value) throws IllegalArgumentException
Check that the given value is not null. If null, throws anIllegalArgumentException.- Parameters:
value- Value to check.- Throws:
IllegalArgumentException- Exception thrown in case of null value.
-
checkNotNull
public static void checkNotNull(Object value, String message) throws IllegalArgumentException
Check that the given value is not null. If null, throws anIllegalArgumentExceptionwith the given message.- Parameters:
value- Value to check.message- Message to put in theIllegalArgumentException.- Throws:
IllegalArgumentException- Exception thrown in case of null value with the given message.
-
checkNotEmpty
public static void checkNotEmpty(Collection<?> value) throws IllegalArgumentException
Check that the givenCollectionis not empty. If empty, throws anIllegalArgumentException.- Parameters:
value-Collectionto check.- Throws:
IllegalArgumentException- Exception thrown in case of emptyCollection.
-
checkNotEmpty
public static void checkNotEmpty(Collection<?> value, String message) throws IllegalArgumentException
Check that the givenCollectionis not empty. If empty, throws anIllegalArgumentExceptionwith the given message.- Parameters:
value-Collectionto check.message- Message to put in theIllegalArgumentException.- Throws:
IllegalArgumentException- Exception thrown in case of emptyCollectionwith the given message.
-
checkNotEmpty
public static void checkNotEmpty(Object[] array) throws IllegalArgumentException
Check that the given array is not empty. If empty, throws anIllegalArgumentException.- Parameters:
array- Array to check.- Throws:
IllegalArgumentException- Exception thrown in case of empty array.
-
checkNotEmpty
public static void checkNotEmpty(Object[] array, String message) throws IllegalArgumentException
Check that the given array is not empty. If empty, throws anIllegalArgumentExceptionwith the given message.- Parameters:
array- Array to check.message- Message to put in theIllegalArgumentException.- Throws:
IllegalArgumentException- Exception thrown in case of empty array with the given message.
-
-