public final class Util extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
isNullOrEmpty(String string)
Returns
true if the given string is null or is the empty string. |
static Double |
parseDouble(String value,
Double defaultValue)
Parses the provided string value into a double value.
|
static Set<String> |
parseExtraTags(String extraTagsString)
Parses the provided extraTags string into a Set of Strings.
|
static Integer |
parseInteger(String value,
Integer defaultValue)
Parses the provided string value into an integer value.
|
static Long |
parseLong(String value,
Long defaultValue)
Parses the provided string value into a long value.
|
static Map<String,String> |
parseTags(String tagsString)
Parses the provided tags string into a Map of String -> String.
|
static String |
trimString(String string,
int maxMessageLength)
Trims a String, ensuring that the maximum length isn't reached.
|
public static boolean isNullOrEmpty(String string)
true
if the given string is null or is the empty string.string
- a string reference to checktrue
if the string is null or is the empty stringpublic static Map<String,String> parseTags(String tagsString)
tagsString
- comma-delimited key-value pairs, e.g. "tag1:value1,tag2:value2".public static Set<String> parseExtraTags(String extraTagsString)
extraTagsString
- comma-delimited tagspublic static Integer parseInteger(String value, Integer defaultValue)
If the string is null or empty this returns the default value.
value
- value to parsedefaultValue
- default valuepublic static Long parseLong(String value, Long defaultValue)
If the string is null or empty this returns the default value.
value
- value to parsedefaultValue
- default valuepublic static Double parseDouble(String value, Double defaultValue)
If the string is null or empty this returns the default value.
value
- value to parsedefaultValue
- default valueCopyright © 2012–2017. All rights reserved.