Java Object NVL nvl(T t, String message)

Here you can find the source of nvl(T t, String message)

Description

Tests the passed object for nullness.

License

Apache License

Parameter

Parameter Description
t The object to test
message The message to associate with the exception, Ignored if null

Return

the object passed in if not null

Declaration

public static <T> T nvl(T t, String message) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**/*w w  w  . j  a  v  a2 s .co  m*/
     * Tests the passed object for nullness. Throws an {@link IllegalArgumentException} if the object is null 
     * @param t  The object to test
     * @param message The message to associate with the exception, Ignored if null
     * @return the object passed in if not null
     */
    public static <T> T nvl(T t, String message) {
        if (t == null)
            throw new IllegalArgumentException(message != null ? message : "Null parameter");
        return t;
    }
}

Related

  1. nvl(T o, T replacement)
  2. nvl(T o, T valueIfNull)
  3. nvl(T object, T defaultValue)
  4. nvl(T s, T def)
  5. nvl(T t, String message)
  6. nvl(T value, String defValue)
  7. nvl(T value, T defaultValue)
  8. nvl(T value, T ifnull)
  9. nvl(T value, T replacement)