Class Assert
java.lang.Object
io.r2dbc.proxy.util.Assert
Assertion library for the implementation.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
requireNonNull
(T t, String message) Checks that a specified object reference is notnull
and throws a customizedIllegalArgumentException
if it is.static <T> T
requireType
(Object value, Class<T> type, String message) Checks that the specified value is of a specific type.
-
Method Details
-
requireNonNull
Checks that a specified object reference is notnull
and throws a customizedIllegalArgumentException
if it is.- Type Parameters:
T
- the type of the reference- Parameters:
t
- the object reference to check for nullitymessage
- the detail message to be used in the event that anIllegalArgumentException
is thrown- Returns:
t
if notnull
- Throws:
IllegalArgumentException
- ift
is {code null}
-
requireType
Checks that the specified value is of a specific type.- Type Parameters:
T
- the type being required- Parameters:
value
- the value to checktype
- the type to requiremessage
- the message to use in exception if type is not as required- Returns:
- the value casted to the required type
- Throws:
IllegalArgumentException
- ifvalue
is not of the required typeIllegalArgumentException
- ifvalue
,type
, ormessage
isnull
-