Package javascalautils
Class Validator
- java.lang.Object
-
- javascalautils.Validator
-
public final class Validator extends java.lang.ObjectUsed internally to validate parameters- Since:
- 1.3
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> TrequireNonNull(T obj)Checks that the specified object reference is notnulland and throwsIllegalArgumentExceptionif it is.static <T> TrequireNonNull(T obj, java.lang.String message)Checks that the specified object reference is notnulland throws a customizedIllegalArgumentExceptionif it is.
-
-
-
Method Detail
-
requireNonNull
public static <T> T requireNonNull(T obj)
Checks that the specified object reference is notnulland and throwsIllegalArgumentExceptionif it is.
Essentially this is very much the same asObjects.requireNonNull(Object)but throws anIllegalArgumentExceptionas opposed to theNullPointerExceptionthe 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 notnulland throws a customizedIllegalArgumentExceptionif it is.
Essentially this is very much the same asObjects.requireNonNull(Object, String)but throws anIllegalArgumentExceptionas opposed to theNullPointerExceptionthe 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 aIllegalArgumentExceptionis thrown- Returns:
- The provided object in case it was non-null
- Throws:
java.lang.IllegalArgumentException- If the provided object wasnull- Since:
- 1.3
-
-