Here you can find the source of nvl(Object value, Object substituteWhenNull)
Parameter | Description |
---|---|
value | the value to test |
substituteWhenNull | substitute value when value is null |
public static Object nvl(Object value, Object substituteWhenNull)
//package com.java2s; /*/* w ww . j a v a 2 s . c o m*/ * This software is distributed under the terms of the FSF * Gnu Lesser General Public License (see lgpl.txt). * * This program is distributed WITHOUT ANY WARRANTY. See the * GNU General Public License for more details. */ public class Main { /** * <tt>nvl</tt> method lets you substitute a value when a null value is * encountered. * * @param value the value to test * @param substituteWhenNull substitute value when value is null * @return substitute when value is null */ public static Object nvl(Object value, Object substituteWhenNull) { return (value != null) ? value : substituteWhenNull; } /** * <tt>nvl</tt> method lets you substitute a value when a null value is * encountered. * * @param value the value to test * @param substituteWhenNull substitute value when value is null * @return substitute when value is null */ public static String nvl(String value, String substituteWhenNull) { return (value != null) ? value : substituteWhenNull; } /** * <tt>nvl</tt> method lets you substitute a value when a null value is * encountered as well as when a non-null value is encountered. * * @param value the value to test * @param substituteWhenNotNull substitute value when value is not null * @param substituteWhenNull substitute value when value is null * @return substitute when value is null */ public static Object nvl(Object value, Object substituteWhenNotNull, Object substituteWhenNull) { return (value != null) ? substituteWhenNotNull : substituteWhenNull; } /** * <tt>nvl</tt> method lets you substitute a value when a null value is * encountered as well as when a non-null value is encountered. * * @param value the value to test * @param substituteWhenNotNull substitute value when value is not null * @param substituteWhenNull substitute value when value is null * @return substitute when value is null */ public static String nvl(String value, String substituteWhenNotNull, String substituteWhenNull) { return (value != null) ? substituteWhenNotNull : substituteWhenNull; } }