public final class TypeUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> List<T> |
createList(T... _entries)
Creates a list from a varargs parameter array.
|
static <T> Map<T,T> |
createMap(T... _args)
Creates a map from the even-sized parameter array.
|
static Properties |
createProperties(String... _keysAndVals)
Factory method for
Properties from an even-sized String array. |
static Pattern |
createRegExPatternIfValid(String _regExStr)
Creates a RegEx Pattern object, if given String is a valid regular expression.
|
static int |
defaultIfNotInteger(String _possibleInt,
int _default)
Returns integer converted from string or default if string could not be converted to int.
|
static boolean |
equalsOne(Object _obj,
Object... _arrObj)
Deprecated.
|
static boolean |
isAnyNull(Object... _objects)
Deprecated.
|
static boolean |
isDouble(String _str)
Checks if the given string is a valid double (including negative values).
|
static boolean |
isDouble(String _str,
boolean _allowNegative)
Checks if the given string is a valid double.
|
static boolean |
isDouble(String _str,
char _separator)
Checks if the given string is a valid double (including negative values) using the given separator.
|
static boolean |
isDouble(String _str,
char _separator,
boolean _allowNegative)
Checks if the given string is a valid double.
|
static boolean |
isInteger(String _str)
Check if string is integer (including negative integers).
|
static boolean |
isInteger(String _str,
boolean _allowNegative)
Check if string is an either positive or negative integer.
|
static boolean |
isValidNetworkPort(int _port,
boolean _allowWellKnown)
Check if the given value is a valid network port (1 - 65535).
|
static boolean |
isValidNetworkPort(String _str,
boolean _allowWellKnown) |
static boolean |
isValidRegex(String _regExStr)
Checks if given String is a valid regular expression.
|
static <T> List<List<T>> |
splitList(List<T> _list,
int _elements)
Split a List into equal parts.
|
static <K,V> List<Map<K,V>> |
splitMap(Map<K,V> _map,
int _nbElements)
Splits _map to a list of maps where each map has _nbElements.
|
static boolean |
strToBool(String _str)
Deprecated.
|
static void |
throwIfAnyNull(String _errMsg,
Object... _objects)
Deprecated.
|
@Deprecated public static boolean strToBool(String _str)
ConverterUtil.strToBool(String)_str - string to validatepublic static boolean isDouble(String _str)
_str - string to checkpublic static boolean isDouble(String _str, char _separator)
_str - string to check_separator - separator to usepublic static boolean isDouble(String _str, boolean _allowNegative)
_str - string to validate_allowNegative - set to true if negative double should be allowedpublic static boolean isDouble(String _str, char _separator, boolean _allowNegative)
_str - string to validate_separator - seperator used (e.g. "." (dot) or "," (comma))_allowNegative - set to true if negative double should be allowedpublic static boolean isInteger(String _str)
_str - string to checkpublic static boolean isInteger(String _str, boolean _allowNegative)
_str - string to validate_allowNegative - negative integer allowedpublic static boolean isValidNetworkPort(int _port,
boolean _allowWellKnown)
_port - 'port' to check_allowWellKnown - allow ports below 1024 (aka reserved well known ports)public static boolean isValidNetworkPort(String _str, boolean _allowWellKnown)
_str - string to check_allowWellKnown - allow well known portisValidNetworkPort(int, boolean)public static boolean isValidRegex(String _regExStr)
_regExStr - regex string to checkpublic static Pattern createRegExPatternIfValid(String _regExStr)
_regExStr - regex string to check@SafeVarargs public static <T> List<T> createList(T... _entries)
T - list type_entries - list entries@SafeVarargs public static <T> Map<T,T> createMap(T... _args)
T - map type_args - parameter array, any type@Deprecated public static boolean isAnyNull(Object... _objects)
CompareUtil.isAnyNull(Object...)_objects - array of objects, may be null@Deprecated public static void throwIfAnyNull(String _errMsg, Object... _objects)
CompareUtil.throwIfAnyNull(String, Object...)_errMsg - error message_objects - objects to checkCompareUtil.throwIfAnyNull(String, Object...)@Deprecated public static boolean equalsOne(Object _obj, Object... _arrObj)
CompareUtil.equalsOne(Object, Object...)_obj - object_arrObj - array of objects to compare topublic static <K,V> List<Map<K,V>> splitMap(Map<K,V> _map, int _nbElements) throws InstantiationException, IllegalAccessException
K - key typeV - value type_map - map to split_nbElements - elements per mapIllegalAccessException - on errorInstantiationException - on errorpublic static <T> List<List<T>> splitList(List<T> _list, int _elements)
T - type_list - list to split_elements - elements per listpublic static Properties createProperties(String... _keysAndVals)
Properties from an even-sized String array._keysAndVals - String array of keys and values, may be null or even-numbered String arraypublic static int defaultIfNotInteger(String _possibleInt, int _default)
_possibleInt - string to convert_default - default to use if string cannot be convertedCopyright © 2018. All rights reserved.