public abstract class StringDefault
extends java.lang.Object
Static functions to apply default values of type string
.
Constructor and Description |
---|
StringDefault() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
emptyIfNull(java.lang.String value)
Return
value if it is not null , otherwise return empty string. |
static java.lang.String |
ifEmpty(java.lang.String value,
java.lang.String defaultValue)
Return
value if it is not null or empty, otherwise return defaultValue . |
static java.lang.String |
ifNull(java.lang.String value,
java.lang.String defaultValue)
Return
value if it is not null , otherwise return defaultValue . |
static java.lang.String |
nullIfEmpty(java.lang.String value)
Return (nullable)
null if value is null or empty, otherwise return value . |
public static java.lang.String emptyIfNull(java.lang.String value)
Return value
if it is not null
, otherwise return empty string.
value
- (nullable) Nullable value.value
if it is not null
, otherwise return empty string.public static java.lang.String ifEmpty(java.lang.String value, java.lang.String defaultValue)
Return value
if it is not null
or empty, otherwise return defaultValue
.
value
- (nullable) Nullable value.defaultValue
- Default value.value
if it is not null
or empty, otherwise return defaultValue
.public static java.lang.String ifNull(java.lang.String value, java.lang.String defaultValue)
Return value
if it is not null
, otherwise return defaultValue
.
value
- (nullable) Nullable value.defaultValue
- Default value.value
if it is not null
, otherwise return defaultValue
.public static java.lang.String nullIfEmpty(java.lang.String value)
Return (nullable) null
if value
is null
or empty, otherwise return value
.
value
- (nullable) Nullable value.null
if value
is null
or empty, otherwise return value
.