Java tutorial
//package com.java2s; public class Main { /** * Will throw IllegalArgumentException if provided object is null on runtime * * @param argument object that should be asserted as not null * @param name name of the object asserted * @throws java.lang.IllegalArgumentException */ public static <T> T notNull(final T argument, final String name) { if (argument == null) { throw new IllegalArgumentException(name + " should not be null!"); } return argument; } }