Package dev.zemco.codegame.util
Class Preconditions
java.lang.Object
dev.zemco.codegame.util.Preconditions
Collection of utility functions for checking validity of arguments.
- Author:
- Erik Zemčík
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringcheckArgumentNotEmpty(String argument, String argumentName) static <T extends Collection<?>>
TcheckArgumentNotEmpty(T argument, String argumentName) static <T> TcheckArgumentNotNull(T argument, String argumentName) static intcheckArgumentPositiveInteger(int argument, String argumentName)
-
Method Details
-
checkArgumentNotNull
- Type Parameters:
T- argument type- Parameters:
argument- argument to checkargumentName- name of the checked argument- Returns:
- non-null instance passed to
argument - Throws:
IllegalArgumentException- ifargumentisnull
-
checkArgumentNotEmpty
- Parameters:
argument- argument to checkargumentName- name of the checked argument- Returns:
- instance passed to
argument - Throws:
IllegalArgumentException- ifargumentisnullor empty
-
checkArgumentNotEmpty
- Type Parameters:
T- collection argument type- Parameters:
argument- argument to checkargumentName- name of the checked argument- Returns:
- instance passed to
argument - Throws:
IllegalArgumentException- ifargumentisnullor empty
-
checkArgumentPositiveInteger
- Parameters:
argument- argument to checkargumentName- name of the checked argument- Returns:
intpassed toargument- Throws:
IllegalArgumentException- ifargumentis less than0
-