Java Object NVL nvl(Object value, String valueWhenNull)

Here you can find the source of nvl(Object value, String valueWhenNull)

Description

Returns the string-representation of value, or valueWhenNull if value is null.

License

Open Source License

Parameter

Parameter Description
value a parameter
valueWhenNull a parameter

Declaration

public static String nvl(Object value, String valueWhenNull) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2010-2015 BSI Business Systems Integration AG.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:/*  w w w.ja  va  2s  .  com*/
 *     BSI Business Systems Integration AG - initial API and implementation
 ******************************************************************************/

public class Main {
    /**
     * Returns the string-representation of <code>value</code>, or <code>valueWhenNull</code> if value is null.
     *
     * @param value
     * @param valueWhenNull
     * @see #substituteWhenEmpty(Object, String)
     */
    public static String nvl(Object value, String valueWhenNull) {
        if (value != null) {
            return value.toString();
        } else {
            return valueWhenNull;
        }
    }
}

Related

  1. nvl(Object objInput, Object objOutput)
  2. nvl(Object source, Object alernative)
  3. NVL(Object str)
  4. nvl(Object value, Object substituteWhenNull)
  5. nvl(Object value, String defaultValue)
  6. nvl(S obj, U nullObject)
  7. nvl(String instr, String defaultValue)
  8. nvl(String instr, String defaultValue)
  9. nvl(String pArg1, String pArg2)