Package javascalautils
Class Validator
- java.lang.Object
-
- javascalautils.Validator
-
public final class Validator extends java.lang.Object
Used internally to validate parameters- Since:
- 1.3
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> T
requireNonNull(T obj)
Checks that the specified object reference is notnull
and and throwsIllegalArgumentException
if it is.static <T> T
requireNonNull(T obj, java.lang.String message)
Checks that the specified object reference is notnull
and throws a customizedIllegalArgumentException
if it is.
-
-
-
Method Detail
-
requireNonNull
public static <T> T requireNonNull(T obj)
Checks that the specified object reference is notnull
and and throwsIllegalArgumentException
if it is.
Essentially this is very much the same asObjects.requireNonNull(Object)
but throws anIllegalArgumentException
as opposed to theNullPointerException
the SDK class throws.- Type Parameters:
T
- The type of the object- Parameters:
obj
- The object to be validated- Returns:
- The provided object in case it was non-null
- Throws:
java.lang.IllegalArgumentException
- If the provided object wasnull
- Since:
- 1.3
-
requireNonNull
public static <T> T requireNonNull(T obj, java.lang.String message)
Checks that the specified object reference is notnull
and throws a customizedIllegalArgumentException
if it is.
Essentially this is very much the same asObjects.requireNonNull(Object, String)
but throws anIllegalArgumentException
as opposed to theNullPointerException
the SDK class throws.- Type Parameters:
T
- The type of the object- Parameters:
obj
- The object to be validatedmessage
- detail message to be used in the event that aIllegalArgumentException
is thrown- Returns:
- The provided object in case it was non-null
- Throws:
java.lang.IllegalArgumentException
- If the provided object wasnull
- Since:
- 1.3
-
-