Package fr.gouv.vitam.common
Class ParametersChecker
- java.lang.Object
-
- fr.gouv.vitam.common.ParametersChecker
-
public final class ParametersChecker extends java.lang.ObjectChecker for Parameters
Can be used for String (testing also emptiness) and for general Object.
For null String only, use the special method.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcheckDateParam(java.lang.String errorMessage, java.lang.String date)static <T extends java.lang.Enum<T>>
voidcheckNullOrEmptyParameter(T key, java.lang.String value, java.util.Set<T> mandatories)Check parameter emptiness or nullitystatic <T extends java.lang.Enum<T>>
voidcheckNullOrEmptyParameters(java.util.Map<T,java.lang.String> parameters, java.util.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 voidcheckParameter(java.lang.String errorMessage, java.lang.Object... parameters)Check if any parameter are null and if so, throw an IllegalArgumentExceptionstatic voidcheckParameter(java.lang.String errorMessage, java.lang.String... parameters)Check if any parameter are null or empty and if so, throw an IllegalArgumentExceptionstatic voidcheckParameterDefault(java.lang.String errorMessage, java.lang.Object... parameters)Check if any parameter are null or empty and if so, throw an IllegalArgumentExceptionstatic voidcheckParameterDefault(java.lang.String errorMessage, java.lang.String... parameters)Check if any parameter are null or empty and if so, throw an IllegalArgumentExceptionstatic voidcheckParameterNullOnly(java.lang.String errorMessage, java.lang.String... parameters)Check if any parameter are null and if so, throw an IllegalArgumentExceptionstatic voidcheckValue(java.lang.String name, long variable, long minValue)Check if an integer parameter is greater or equals to minValuestatic booleanisNotEmpty(java.lang.String... parameters)Check if any parameter are null or empty and if so, return false
-
-
-
Method Detail
-
checkParameter
public static void checkParameter(java.lang.String errorMessage, java.lang.String... parameters)Check if any parameter are null or empty and if so, throw an IllegalArgumentException- Parameters:
errorMessage- the error messageparameters- parameters to be checked- Throws:
java.lang.IllegalArgumentException- if null or empty
-
checkParameterDefault
public static void checkParameterDefault(java.lang.String errorMessage, java.lang.String... parameters)Check if any parameter are null or empty and if so, throw an IllegalArgumentException- Parameters:
errorMessage- the error messageparameters- set of parameters- Throws:
java.lang.IllegalArgumentException- if null or empty
-
isNotEmpty
public static boolean isNotEmpty(java.lang.String... parameters)
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
public static void checkParameterDefault(java.lang.String errorMessage, java.lang.Object... parameters)Check if any parameter are null or empty and if so, throw an IllegalArgumentException- Parameters:
errorMessage- the error messageparameters- set of parameters- Throws:
java.lang.IllegalArgumentException- if null or empty
-
checkParameterNullOnly
public static void checkParameterNullOnly(java.lang.String errorMessage, java.lang.String... parameters)Check if any parameter are null and if so, throw an IllegalArgumentException- Parameters:
errorMessage- the error messageparameters- parameters to be checked- Throws:
java.lang.IllegalArgumentException- if null
-
checkParameter
public static void checkParameter(java.lang.String errorMessage, java.lang.Object... parameters)Check if any parameter are null and if so, throw an IllegalArgumentException- Parameters:
errorMessage- set of parametersparameters- set parameters to be checked- Throws:
java.lang.IllegalArgumentException- if null
-
checkDateParam
public static void checkDateParam(java.lang.String errorMessage, java.lang.String date)
-
checkValue
public static void checkValue(java.lang.String name, long variable, long minValue)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 java.lang.Enum<T>> void checkNullOrEmptyParameter(T key, java.lang.String value, java.util.Set<T> mandatories)Check parameter emptiness or nullity- Parameters:
key- the attribute namevalue- the attribute value to checkmandatories- the set of mandatories field- Throws:
java.lang.IllegalArgumentException- if an argument is null or empty against mandatory
-
checkNullOrEmptyParameters
public static <T extends java.lang.Enum<T>> void checkNullOrEmptyParameters(java.util.Map<T,java.lang.String> parameters, java.util.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:
java.lang.IllegalArgumentException- if an argument is null or empty against mandatory
-
checkNullOrEmptyParameters
public static <T extends VitamParameter> void checkNullOrEmptyParameters(T parameter)
Check parameters emptiness or nullity- Parameters:
parameter- the template of vitam parameter- Throws:
java.lang.IllegalArgumentException- if an argument is null or empty against mandatory
-
checkNullOrEmptyParameters
public static <T extends VitamParameter> void checkNullOrEmptyParameters(T... parameters)
Check parameters emptiness or nullity- Parameters:
parameters- the template of vitam parameter- Throws:
java.lang.IllegalArgumentException- if an argument is null or empty against mandatory
-
-