public final class ParametersChecker extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_ERROR |
static Pattern |
HTML_PATTERN |
static List<String> |
RULES |
static Pattern |
UNPRINTABLE_PATTERN |
static String[] |
ZERO_ARRAY_STRING |
Modifier and Type | Method and Description |
---|---|
static void |
checkParameter(String errorMessage,
Object... parameters)
Check if any parameter are null and if so, throw an
IllegalArgumentException
|
static void |
checkParameter(String errorMessage,
String... parameters)
Check if any parameter are null or empty and if so, throw an
IllegalArgumentException
|
static void |
checkParameterDefault(String errorMessage,
Object... parameters)
Check if any parameter are null or empty and if so, throw an
IllegalArgumentException
|
static void |
checkParameterDefault(String errorMessage,
String... parameters)
Check if any parameter are null or empty and if so, throw an
IllegalArgumentException
|
static void |
checkParameterNullOnly(String errorMessage,
String... parameters)
Check if any parameter are null and if so, throw an
IllegalArgumentException
|
static void |
checkSanityString(String... strings)
Check external argument (null is consider as correct)
|
static String |
checkSanityString(String value)
Check external argument to avoid Path Traversal attack
|
static void |
checkValue(String name,
long variable,
long minValue)
Check if an integer parameter is greater or equals to minValue
|
static boolean |
isNotEmpty(String... parameters)
Check if any parameter are null or empty and if so, return false
|
public static final String DEFAULT_ERROR
public static final Pattern UNPRINTABLE_PATTERN
public static final String[] ZERO_ARRAY_STRING
public static final Pattern HTML_PATTERN
public static void checkParameter(String errorMessage, String... parameters)
errorMessage
- the error messageparameters
- parameters to be checkedIllegalArgumentException
- if null or emptypublic static void checkParameterDefault(String errorMessage, String... parameters)
errorMessage
- the error messageparameters
- set of parametersIllegalArgumentException
- if null or emptypublic static boolean isNotEmpty(String... parameters)
parameters
- set of parameterspublic static void checkParameterDefault(String errorMessage, Object... parameters)
errorMessage
- the error messageparameters
- set of parametersIllegalArgumentException
- if null or emptypublic static void checkParameterNullOnly(String errorMessage, String... parameters)
errorMessage
- the error messageparameters
- parameters to be checkedIllegalArgumentException
- if nullpublic static void checkParameter(String errorMessage, Object... parameters)
errorMessage
- set of parametersparameters
- set parameters to be checkedIllegalArgumentException
- if nullpublic static void checkValue(String name, long variable, long minValue)
name
- name of the variablevariable
- the value of variable to checkminValue
- the min valuepublic static String checkSanityString(String value) throws InvalidArgumentException
value
- to checkInvalidArgumentException
public static void checkSanityString(String... strings) throws InvalidArgumentException
strings
- InvalidArgumentException
Copyright © 2009–2020 Waarp. All rights reserved.