Here you can find the source of assertNotNull(final T object, final String message)
object
is null
.Parameter | Description |
---|---|
object | - Object to check |
message | - Message for the NullPointerException |
public static <T> T assertNotNull(final T object, final String message)
//package com.java2s; //License from project: Apache License public class Main { /**//from ww w. j a v a 2s . c o m * Checks if the given <code>object</code> is <code>null</code>.<br> * If it is, a new {@link NullPointerException} is thrown with the given message. * @param object - Object to check * @param message - Message for the {@link NullPointerException} * @return The given object if it isn't null. */ public static <T> T assertNotNull(final T object, final String message) { if (object == null) { throw new NullPointerException(message); } return object; } }