Here you can find the source of assertNotNull(final T value, final String param)
null
or not.
Parameter | Description |
---|---|
value | the value to check |
param | the name of the attribute storing the value to check |
Parameter | Description |
---|---|
IllegalArgumentException | an exception |
public static <T> void assertNotNull(final T value, final String param) throws IllegalArgumentException
//package com.java2s; //License from project: Open Source License public class Main { /**//w w w. ja v a 2 s . com * This constant {@link String} represents the error message to use then an {@link IllegalArgumentException} * is thrown because the assert on <code>null</code> value check fails. */ private static final String ILLEGAL_ARGUMENT_EXCEPTION_MSG = "the paramter cannot be null: "; /** * This method verifies if the input argument is <code>null</code> or not. * If it's <code>null</code> an {@link IllegalArgumentException} is thrown. * * @param value the value to check * @param param the name of the attribute storing the value to check * * @throws IllegalArgumentException */ public static <T> void assertNotNull(final T value, final String param) throws IllegalArgumentException { if (null == value) { throw new IllegalArgumentException( ILLEGAL_ARGUMENT_EXCEPTION_MSG + ((null != param) ? param : "unknown")); } } }