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 not string was not a integer type.
|
static boolean |
equalsOne(Object _obj,
Object... _arrObj)
Returns true if the specified object equals at least one of the specified other objects.
|
static boolean |
isAnyNull(Object... _objects)
Checks if any of the passed in objects is null.
|
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.
use
ConverterUtilTest#strToBool(String) |
static void |
throwIfAnyNull(String _errMsg,
Object... _objects) |
@Deprecated public static boolean strToBool(String _str)
ConverterUtilTest#strToBool(String)_str - public 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 - public static boolean isInteger(String _str, boolean _allowNegative)
_str - _allowNegative - negative integer allowedpublic static boolean isValidNetworkPort(int _port,
boolean _allowWellKnown)
_port - _allowWellKnown - allow ports below 1024 (aka reserved well known ports)public static boolean isValidNetworkPort(String _str, boolean _allowWellKnown)
_str - _allowWellKnown - isValidNetworkPort(int, boolean)public static boolean isValidRegex(String _regExStr)
_regExStr - public static Pattern createRegExPatternIfValid(String _regExStr)
_regExStr - @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 typepublic static boolean isAnyNull(Object... _objects)
_objects - array of objects, may be nullpublic static boolean equalsOne(Object _obj, Object... _arrObj)
_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 - _nbElements - IllegalAccessExceptionInstantiationExceptionpublic static <T> List<List<T>> splitList(List<T> _list, int _elements)
T - _list - _elements - public 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 - _default - Copyright © 2018. All rights reserved.