Java Utililty Methods Object NVL

List of utility methods to do Object NVL

Description

The list of methods to do Object NVL are organized into topic(s).

Method

Objectnvl(Object value, Object substituteWhenNull)
nvl method lets you substitute a value when a null value is encountered.
return (value != null) ? value : substituteWhenNull;
Stringnvl(Object value, String defaultValue)
nvl
String result = defaultValue;
if (value != null) {
    result = value.toString();
return result;
Stringnvl(Object value, String valueWhenNull)
Returns the string-representation of value, or valueWhenNull if value is null.
if (value != null) {
    return value.toString();
} else {
    return valueWhenNull;
Tnvl(S obj, U nullObject)
nvl
if (obj != null) {
    return obj;
return nullObject;
Stringnvl(String instr, String defaultValue)
nvl
return instr == null || "".equals(instr) ? defaultValue : instr;
Stringnvl(String instr, String defaultValue)
nvl
return instr != null && !"".equals(instr) ? instr : defaultValue;
Stringnvl(String pArg1, String pArg2)
Returns arg2 if arg1 is null or empty, or arg1 otherwise.
return !isNull(pArg1) ? pArg1 : pArg2;
Stringnvl(String pValue)
(OVERLOADED) SQL like Null value replace utility converts to ""
return nvl(pValue, "");
Stringnvl(String s)
nvl
return s == null ? "" : s; 
Stringnvl(String s, String def)
Returns s if it is not null and def otherwise.
if (s == null)
    return def;
return s;