public class Util extends Object
Modifier and Type | Field and Description |
---|---|
static SafeHtml |
NBSP_SAFE_HTML
A non-breaking space in SafeHtml form.
|
Constructor and Description |
---|
Util() |
Modifier and Type | Method and Description |
---|---|
static int |
constrain(int value,
int min,
int max)
Constrains the value by a minimum and max value.
|
static <T> List<T> |
createList(T... element)
Creates a new list and adds the element(s).
|
static boolean |
equalWithNull(Object obj1,
Object obj2)
Does an equals check by first checking identity, then equality.
|
static <T> void |
fill(List<T> list,
T[] elements)
Populates a list with an array of elements.
|
static Element |
getImage(ImageResource ir)
Returns an element for the given image.
|
static boolean |
isEmptyString(String string)
Returns true if the string is null or equals to the empty string.
|
static boolean |
isInteger(String value)
Tests if the value is an integer.
|
static int |
parseInt(String value,
int defaultValue)
Parses a string value and returns an integer.
|
static Overflow |
parseOverflow(String value)
Parses a string value and returns the applicable
Overflow object. |
static Element[] |
toElementArray(<any> nodes)
Converts a node list to an element array.
|
static Element[] |
toElementArray(List<Element> nodes)
Converts a node list to an element array.
|
public static final SafeHtml NBSP_SAFE_HTML
public static int constrain(int value, int min, int max)
value
- the valuemin
- the minimummax
- the maximumpublic static <T> List<T> createList(T... element)
T
- the element typeelement
- the item to add to the listpublic static boolean equalWithNull(Object obj1, Object obj2)
obj1
- object 1obj2
- object 2public static <T> void fill(List<T> list, T[] elements)
T
- the element typelist
- the listelements
- the elements to be added to the listpublic static Element getImage(ImageResource ir)
ir
- the image resourcepublic static boolean isEmptyString(String string)
string
- the string to testpublic static boolean isInteger(String value)
value
- the value to testpublic static int parseInt(String value, int defaultValue)
value
- the string valuedefaultValue
- the default valuepublic static Overflow parseOverflow(String value)
Overflow
object.value
- the string valueOverflow
objectpublic static Element[] toElementArray(List<Element> nodes)
nodes
- the nodespublic static Element[] toElementArray(<any> nodes)
nodes
- the nodesCopyright © 2018. All rights reserved.