| Modifier | Constructor and Description |
|---|---|
private |
GetUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
ensureNonNull(T value)
Get value if it is not null.
|
static <T> T |
ensureNonNull(T value,
T defaultValue)
Get value and ensure that the value is not null
|
static java.lang.String |
ensureNonNullAndNonEmpty(java.lang.String value,
java.lang.String dflt)
Get non-null non-empty string.
|
static java.lang.String |
ensureNonNullStr(java.lang.String value)
Ensure that a string will not be null.
|
static <T> T |
findFirstNonNull(T... objects)
Find the first non-null value in an array and return that.
|
public static <T> T ensureNonNull(T value,
T defaultValue)
T - type of valuevalue - the valuedefaultValue - the default value to be returned if the value is nulljava.lang.AssertionError - if both the value and the default value are nullpublic static <T> T ensureNonNull(T value)
T - type of valuevalue - the valuejava.lang.AssertionError - if the value is nullpublic static <T> T findFirstNonNull(T... objects)
T - type of valueobjects - array to find valuejava.lang.AssertionError - if the array is null or it doesn't contain a
non-null valuepublic static java.lang.String ensureNonNullAndNonEmpty(java.lang.String value,
@Constraint(value="notEmpty(X)")
java.lang.String dflt)
value - a base stringdflt - default string to be provided if value is null or emptypublic static java.lang.String ensureNonNullStr(java.lang.String value)
value - value to be checked