Java Object NVL nvl(T value, T replacement)

Here you can find the source of nvl(T value, T replacement)

Description

nvl

License

LGPL

Declaration

public static <T extends Number> T nvl(T value, T replacement) 

Method Source Code

//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;
    }
}

Related

  1. nvl(T t, String message)
  2. nvl(T value, String defValue)
  3. nvl(T value, T defaultValue)
  4. nvl(T value, T ifnull)
  5. nvl(T value, T replacement)
  6. nvl(T value, T value2)
  7. nvl(T... objs)
  8. nvl(T... objs)
  9. nvl(T... objs)