public class ParamChecker extends Object
Constructor and Description |
---|
ParamChecker() |
Modifier and Type | Method and Description |
---|---|
static Date |
checkDateOozieTZ(String date,
String name)
Check whether the value is Oozie processing timezone data format.
|
static String |
checkFrequency(String val)
Check whether a value is a valid coordinator frequency.
|
static int |
checkGEZero(int value,
String name)
Check whether the value is greater than or equals to 0.
|
static int |
checkGTZero(int value,
String name)
Check whether the value is greater than or equals 0.
|
static int |
checkInteger(String val,
String name)
Check whether the value is Integer.
|
static int |
checkLEZero(int value,
String name)
Check whether the value is less than or equal to 0.
|
static TimeZone |
checkTimeZone(String tzStr,
String name)
Check whether the value mention correct Timezone.
|
static boolean |
isMember(String item,
String[] members,
String name)
Check whether an item is a member of an array of string
|
static boolean |
isValidIdentifier(String token)
Return if the specified token is a valid Java identifier.
|
static String |
notEmpty(String str,
String name)
Check that a string is not null and not empty.
|
static String |
notEmpty(String str,
String name,
String info)
Check that a string is not null and not empty.
|
static List<String> |
notEmptyElements(List<String> list,
String name)
Check that a list is not null and that none of its elements is null.
|
static <T> T |
notNull(T obj,
String name)
Check that a value is not null.
|
static <T> List<T> |
notNullElements(List<T> list,
String name)
Check that a list is not null and that none of its elements is null.
|
static String |
validateActionName(String actionName)
Check that the given string is a valid action name [a-zA-Z_][0-9a-zA-Z_\-]* and not longer than 128 chars.
|
public ParamChecker()
public static <T> T notNull(T obj, String name)
T
- the type of the objectobj
- value.name
- parameter name for the exception message.public static <T> List<T> notNullElements(List<T> list, String name)
T
- the type of the listlist
- the list of strings.name
- parameter name for the exception message.public static String notEmpty(String str, String name)
str
- value.name
- parameter name for the exception message.public static String notEmpty(String str, String name, String info)
str
- value.name
- parameter name for the exception message.info
- additional information to be printed with the exception messagepublic static List<String> notEmptyElements(List<String> list, String name)
list
- the list of strings.name
- parameter name for the exception message.public static String validateActionName(String actionName)
actionName
- string to validate is a token.public static boolean isValidIdentifier(String token)
token
- string to validate if it is a valid Java identifier.public static int checkGTZero(int value, String name)
value
- : value to testname
- : Name of the parameterpublic static int checkGEZero(int value, String name)
value
- : value to testname
- : Name of the parameterpublic static int checkLEZero(int value, String name)
value
- : value to testname
- : Name of the parameterpublic static int checkInteger(String val, String name)
val
- : value to testname
- : Name of the parameterpublic static String checkFrequency(String val)
val
- : value to testpublic static Date checkDateOozieTZ(String date, String name)
date
- : date to testname
- : Name of the parameterpublic static TimeZone checkTimeZone(String tzStr, String name)
tzStr
- : timezone to testname
- : Name of the parameterpublic static boolean isMember(String item, String[] members, String name)
item
- : item to testmembers
- : List of items in stringname
- : Name of the parameterCopyright © 2018 Apache Software Foundation. All rights reserved.