Package fr.gouv.vitam.common
Class ParametersChecker
java.lang.Object
fr.gouv.vitam.common.ParametersChecker
Checker for Parameters
Can be used for String (testing also emptiness) and for general Object.
For null String only, use the special method.
Can be used for String (testing also emptiness) and for general Object.
For null String only, use the special method.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkDateParam
(String errorMessage, String date) static <T extends Enum<T>>
voidcheckNullOrEmptyParameter
(T key, String value, Set<T> mandatories) Check parameter emptiness or nullitystatic <T> List<T>
checkNullOrEmptyParameters
(String errorMessage, List<T> parameters) Check List parameters emptiness or nullitystatic <T extends Enum<T>>
voidcheckNullOrEmptyParameters
(Map<T, String> parameters, Set<T> mandatories) Check parameters emptiness or nullitystatic <T extends VitamParameter>
voidcheckNullOrEmptyParameters
(T parameter) Check parameters emptiness or nullitystatic <T extends VitamParameter>
voidcheckNullOrEmptyParameters
(T... parameters) Check parameters emptiness or nullitystatic void
checkParameter
(String errorMessage, Object... parameters) Check if any parameter are null and if so, throw an IllegalArgumentExceptionstatic void
checkParameter
(String errorMessage, String... parameters) Check if any parameter are null or empty and if so, throw an IllegalArgumentExceptionstatic void
checkParameterDefault
(String errorMessage, Object... parameters) Check if any parameter are null or empty and if so, throw an IllegalArgumentExceptionstatic void
checkParameterDefault
(String errorMessage, String... parameters) Check if any parameter are null or empty and if so, throw an IllegalArgumentExceptionstatic void
checkParameterNullOnly
(String errorMessage, String... parameters) Check if any parameter are null and if so, throw an IllegalArgumentExceptionstatic void
checkValue
(String name, long variable, long minValue) Check if an integer parameter is greater or equals to minValuestatic boolean
isNotEmpty
(String... parameters) Check if any parameter are null or empty and if so, return false
-
Method Details
-
checkParameter
Check if any parameter are null or empty and if so, throw an IllegalArgumentException- Parameters:
errorMessage
- the error messageparameters
- parameters to be checked- Throws:
IllegalArgumentException
- if null or empty
-
checkParameterDefault
Check if any parameter are null or empty and if so, throw an IllegalArgumentException- Parameters:
errorMessage
- the error messageparameters
- set of parameters- Throws:
IllegalArgumentException
- if null or empty
-
isNotEmpty
Check if any parameter are null or empty and if so, return false- Parameters:
parameters
- set of parameters- Returns:
- True if not null and not empty neither containing only spaces
-
checkParameterDefault
Check if any parameter are null or empty and if so, throw an IllegalArgumentException- Parameters:
errorMessage
- the error messageparameters
- set of parameters- Throws:
IllegalArgumentException
- if null or empty
-
checkParameterNullOnly
Check if any parameter are null and if so, throw an IllegalArgumentException- Parameters:
errorMessage
- the error messageparameters
- parameters to be checked- Throws:
IllegalArgumentException
- if null
-
checkParameter
Check if any parameter are null and if so, throw an IllegalArgumentException- Parameters:
errorMessage
- set of parametersparameters
- set parameters to be checked- Throws:
IllegalArgumentException
- if null
-
checkDateParam
-
checkValue
Check if an integer parameter is greater or equals to minValue- Parameters:
name
- name of the variablevariable
- the value of variable to checkminValue
- the min value
-
checkNullOrEmptyParameter
public static <T extends Enum<T>> void checkNullOrEmptyParameter(T key, String value, Set<T> mandatories) Check parameter emptiness or nullity- Parameters:
key
- the attribute namevalue
- the attribute value to checkmandatories
- the set of mandatories field- Throws:
IllegalArgumentException
- if an argument is null or empty against mandatory
-
checkNullOrEmptyParameters
public static <T extends Enum<T>> void checkNullOrEmptyParameters(Map<T, String> parameters, Set<T> mandatories) Check parameters emptiness or nullity- Parameters:
parameters
- the map parameters (key = attribute name, value = attribute value)mandatories
- the set of mandatories field- Throws:
IllegalArgumentException
- if an argument is null or empty against mandatory
-
checkNullOrEmptyParameters
Check parameters emptiness or nullity- Parameters:
parameter
- the template of vitam parameter- Throws:
IllegalArgumentException
- if an argument is null or empty against mandatory
-
checkNullOrEmptyParameters
Check parameters emptiness or nullity- Parameters:
parameters
- the template of vitam parameter- Throws:
IllegalArgumentException
- if an argument is null or empty against mandatory
-
checkNullOrEmptyParameters
Check List parameters emptiness or nullity- Parameters:
parameters
- list of parameters- Returns:
- list of parameters
- Throws:
IllegalArgumentException
- if list is null or empty
-