public final class Validator extends Object
Modifier and Type | Method and Description |
---|---|
static <T> T |
requireNonNull(T obj)
Checks that the specified object reference is not
null and and throws IllegalArgumentException if it is. |
static <T> T |
requireNonNull(T obj,
String message)
Checks that the specified object reference is not
null and throws a customized IllegalArgumentException if it is. |
public static <T> T requireNonNull(T obj)
null
and and throws IllegalArgumentException
if it is. Objects.requireNonNull(Object)
but throws an IllegalArgumentException
as opposed to the
NullPointerException
the SDK class throws.T
- The type of the objectobj
- The object to be validatedIllegalArgumentException
- If the provided object was null
public static <T> T requireNonNull(T obj, String message)
null
and throws a customized IllegalArgumentException
if it is. Objects.requireNonNull(Object, String)
but throws an IllegalArgumentException
as opposed to the
NullPointerException
the SDK class throws.T
- The type of the objectobj
- The object to be validatedmessage
- detail message to be used in the event that a IllegalArgumentException
is thrownIllegalArgumentException
- If the provided object was null
Copyright © 2015, Peter Nerg Apache License v2.0