spring-framework / org.springframework.util / Assert / notNull

notNull

open static fun notNull(@Nullable object: Any, message: String): Unit

Assert that an object is not null.

Assert.notNull(clazz, "The class must not be null");

Parameters

object - the object to check

message - the exception message to use if the assertion fails

Exceptions

IllegalArgumentException - if the object is null

open static fun notNull(@Nullable object: Any, messageSupplier: Supplier<String>): Unit

Assert that an object is not null.

 Assert.notNull(clazz, () -> "The class '" + clazz.getName() + "' must not be null"); 

Parameters

object - the object to check

messageSupplier - a supplier for the exception message to use if the assertion fails

Exceptions

IllegalArgumentException - if the object is null

Since
5.0

open static fun notNull(@Nullable object: Any): Unit