public class Util extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
Util() |
| Modifier and Type | Method and Description |
|---|---|
static Boolean |
getVariableValueAsBoolean(Object var)
Treat a variable as an boolean in JavaScript style.
|
static Integer |
getVariableValueAsInteger(Object var)
Treat a variable as an integer in JavaScript style.
|
static String |
join(List<String> strings)
Join the
strings into one string. |
static String |
join(List<String> strings,
String delimiter)
Join the
strings into one string with delimiter in
between. |
static String |
join(String[] strings)
Join the
strings into one string. |
static String |
join(String[] strings,
String delimiter)
Join the
strings into one string with delimiter in
between. |
static String[] |
match(Pattern pattern,
String string,
boolean isGlobal)
Get all the matches for
string compiled by pattern. |
static List<Object> |
removeDuplicates(List<Object> decorations,
String source)
Remove identical adjacent tags from
decorations. |
static boolean |
test(Pattern pattern,
String string)
Test whether the
string has at least one match by
pattern. |
public static Boolean getVariableValueAsBoolean(Object var)
var - the variable to get value frompublic static Integer getVariableValueAsInteger(Object var)
var - the variable to get value fromIllegalArgumentException - the data type of var is neither
integer nor boolean.public static String[] match(Pattern pattern, String string, boolean isGlobal)
string compiled by pattern. If
isGlobal is true, the return results will only include the
group 0 matches. It is similar to string.match(regexp) in JavaScript.pattern - the regexpstring - the stringisGlobal - similar to JavaScript /g flagpublic static boolean test(Pattern pattern, String string)
string has at least one match by
pattern.pattern - the regexpstring - the string to testpublic static String join(List<String> strings)
strings into one string.strings - the string list to joinpublic static String join(List<String> strings, String delimiter)
strings into one string with delimiter in
between.strings - the string list to joindelimiter - the delimiterpublic static String join(String[] strings)
strings into one string.strings - the string list to joinpublic static String join(String[] strings, String delimiter)
strings into one string with delimiter in
between. It is similar to RegExpObject.test(string) in JavaScript.strings - the string list to joindelimiter - the delimiterpublic static List<Object> removeDuplicates(List<Object> decorations, String source)
decorations.decorations - see Job.decorationssource - the source codedecorations after treatmentIllegalArgumentException - the size of decoration is not
a multiple of 2Copyright © 2015. All rights reserved.