public final class Parameters extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
checkCondition(boolean condition)
Checks the truth of the given condition checking parameters validity.
|
static void |
checkCondition(boolean condition,
String msg,
Object... args)
Checks the truth of the given condition checking parameters validity.
|
static <T> T |
checkNotNull(T ref)
Checks that the given reference is not
null and returns it
in case of success. |
static <T> T |
checkNotNull(T ref,
String msg,
Object... args)
Checks that the given reference is not
null and returns it
in case of success. |
static <T> T |
checkType(Object ref,
Class<T> type)
Checks the type of the given reference and, in case of success, casts
and returns it.
|
static <T> T |
checkType(Object ref,
Class<T> type,
String msg,
Object... args)
Checks the type of the given reference and, in case of success, casts
and returns it.
|
public static <T> T checkNotNull(T ref)
null and returns it
in case of success.T - the type of the given reference.ref - the reference to test.null) reference.NullPointerException - if the given reference is null.public static <T> T checkNotNull(T ref,
String msg,
Object... args)
null and returns it
in case of success.T - the type of the given reference.ref - the reference to test.msg - the error message format string.args - the error message arguments.null) reference.NullPointerException - if the given reference is null.public static void checkCondition(boolean condition)
condition - the boolean condition to test.IllegalArgumentException - if the condition is false.public static void checkCondition(boolean condition,
String msg,
Object... args)
condition - the boolean condition to test.msg - the error message format string.args - the error message arguments.IllegalArgumentException - if the condition is false.public static <T> T checkType(Object ref, Class<T> type)
T - the expected type of the given reference.ref - the reference to test.type - the expected type of the given reference.NullPointerException - if type is null.ClassCastException - if the given reference doesn't represent
an instance of the expected class.public static <T> T checkType(Object ref, Class<T> type, String msg, Object... args)
T - the expected type of the given reference.ref - the reference to test.type - the expected type of the given reference.msg - the error message format string.args - the error message arguments.NullPointerException - if type is null.ClassCastException - if the given reference doesn't represent
an instance of the given class.Copyright © 2012–2015. All rights reserved.