Here you can find the source of nvl(T value, T replacement)
public static <T extends Number> T nvl(T value, T replacement)
//package com.java2s; /*//from w ww . j a va 2s.c om * ============================================================================ * GNU Lesser General Public License * ============================================================================ * * ZKTest - Free ZeroKode testing library. * Copyright (C) 2011 Telesoft Consulting GmbH http://www.telesoft-consulting.at * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; If not, see http://www.gnu.org/licenses/ * * Telesoft Consulting GmbH * Gumpendorferstra?e 83-85 * House 1, 1st Floor, Office No.1 * 1060 Vienna, Austria * http://www.telesoft-consulting.at/ */ public class Main { public static String nvl(String value) { return nvl(value, "".intern()); } public static String nvl(String value, String replacement) { if (value == null) { return replacement; } return value; } public static String nvl(Object value, String replacement) { if (value == null) { return replacement; } return value.toString(); } public static <T extends Number> T nvl(T value, T replacement) { if (value == null) { return replacement; } return value; } }