public final class Assert extends Object
Modifier and Type | Method and Description |
---|---|
static <T> T |
requireNonNull(T t,
String message)
Checks that a specified object reference is not
null and throws a customized IllegalArgumentException if it is. |
static <T> T |
requireType(Object value,
Class<T> type,
String message)
Checks that the specified value is of a specific type.
|
public static <T> T requireNonNull(@Nullable T t, String message)
null
and throws a customized IllegalArgumentException
if it is.T
- the type of the referencet
- the object reference to check for nullitymessage
- the detail message to be used in the event that an IllegalArgumentException
is thrownt
if not null
IllegalArgumentException
- if t
is {code null}public static <T> T requireType(Object value, Class<T> type, String message)
T
- the type being requiredvalue
- the value to checktype
- the type to requiremessage
- the message to use in exception if type is not as requiredIllegalArgumentException
- if value
is not of the required typeIllegalArgumentException
- if value
, type
, or message
is null
Copyright © 2024. All rights reserved.