|
| Query |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||
com.sas.iquery.util.Preconditions
public final class Preconditions
Preconditions - a static class to assist with input parameter validation.
Output messages are tuned specifically for input parameters to methods or constructors.
Originally part of com.sas.iquery.metadata.impl.Utils.
| Constructor Summary | |
|---|---|
Preconditions()
|
|
| Method Summary | ||
|---|---|---|
static void |
checkExpression(boolean expression)
Throw an IQueryServicesIllegalArgumentException if the expression if false. |
|
static void |
checkExpression(boolean expression,
java.lang.String parameterName)
Throw an IQueryServicesIllegalArgumentException with a descriptive message
containing the input parameter name if the expression if false. |
|
static
|
ensureNonNull(T reference)
Checks to see if object is null and if so, throw an IQueryServicesIllegalArgumentException
with a descriptive message. |
|
static
|
ensureNonNull(T reference,
org.apache.log4j.Logger logger)
|
|
static
|
ensureNonNull(T reference,
java.lang.String parameterName)
checks to see if object is null and if so, throw an IQueryServicesIllegalArgumentException
with a descriptive message containing the parameter name. |
|
static
|
ensureNonNull(T reference,
java.lang.String parameterName,
org.apache.log4j.Logger logger)
|
|
static
|
ensureNonNullElements(java.util.List<? extends T> values)
checks to see if the input list contains a null element and if so, throw an IQueryServicesIllegalArgumentException exception with a descriptive message. |
|
static
|
ensureNonNullElements(java.util.List<? extends T> values,
java.lang.String listName)
Checks to see if the input list contains a null element and if so, throw an IQueryServicesIllegalArgumentException exception with a descriptive message. |
|
static
|
ensureNonNullElements(java.util.List<? extends T> values,
java.lang.String listName,
org.apache.log4j.Logger logger)
Checks to see if the input list contains a null element and if so, throw an IQueryServicesIllegalArgumentException exception with a descriptive message. |
|
static
|
ensureNonNullTypedElements(java.util.List<? extends T> values,
java.lang.Class<T> type)
Checks to see if the input list contains a null element, or an element of an invalid type and throw an IQueryServicesIllegalArgumentException. |
|
static
|
ensureNonNullTypedElements(java.util.List<? extends T> values,
java.lang.Class<T> type,
org.apache.log4j.Logger logger)
Checks to see if the input list contains a null element, or an element of an invalid type and throw an IQueryServicesIllegalArgumentException. |
|
static
|
ensureNonNullTypedElements(java.util.List<? extends T> values,
java.lang.Class<T> type,
java.lang.String listName)
Checks to see if the input list contains a null element, or an element of an invalid type and throw an IQueryServicesIllegalArgumentException. |
|
static
|
ensureNonNullTypedElements(java.util.List<? extends T> values,
java.lang.Class<T> type,
java.lang.String listName,
org.apache.log4j.Logger logger)
Checks to see if the input list contains a null element, or an element of an invalid type and throw an IQueryServicesIllegalArgumentException. |
|
static
|
ensureNonNullWithMessage(T reference,
java.lang.String key,
java.lang.Object... args)
|
|
| Constructor Detail |
|---|
public Preconditions()
| Method Detail |
|---|
public static <T> T ensureNonNull(T reference)
IQueryServicesIllegalArgumentException
with a descriptive message.
IQ has historically thrown IQueryServicesIllegalArgumentException instead of NullPointerException,
when client applications have passed in a null pointer.
IQueryServicesIllegalArgumentException - if reference is null
public static <T> T ensureNonNull(T reference,
org.apache.log4j.Logger logger)
public static <T> T ensureNonNull(T reference,
java.lang.String parameterName)
IQueryServicesIllegalArgumentException
with a descriptive message containing the parameter name.
IQ has historically thrown IQueryServicesIllegalArgumentException instead of NullPointerException,
when client applications have passed in a null pointer.
IQueryServicesIllegalArgumentException - if reference is null
public static <T> T ensureNonNullWithMessage(T reference,
java.lang.String key,
java.lang.Object... args)
public static <T> T ensureNonNull(T reference,
java.lang.String parameterName,
org.apache.log4j.Logger logger)
public static <T> void ensureNonNullElements(@NonNull
java.util.List<? extends T> values)
IQueryServicesIllegalArgumentException exception with a descriptive message.
values - the input list
public static <T> void ensureNonNullElements(@NonNull
java.util.List<? extends T> values,
java.lang.String listName)
IQueryServicesIllegalArgumentException exception with a descriptive message.
This signature allows the caller to provide a name for the input list.
values - the input listlistName - the name of the input list
public static <T> void ensureNonNullElements(@NonNull
java.util.List<? extends T> values,
java.lang.String listName,
@NonNull
org.apache.log4j.Logger logger)
IQueryServicesIllegalArgumentException exception with a descriptive message.
This signature allows the caller to provide a name for the input list.
This signature also writes an error to the log.
values - the input listlistName - the name of the input list
public static <T> void ensureNonNullTypedElements(@NonNull
java.util.List<? extends T> values,
@NonNull
java.lang.Class<T> type)
IQueryServicesIllegalArgumentException.
Use this method when callers are not likely to be using generics (i.e. legacy callers) and you need your own run time type checking.
values - the input listtype - the expected type of each list element
public static <T> void ensureNonNullTypedElements(@NonNull
java.util.List<? extends T> values,
@NonNull
java.lang.Class<T> type,
@NonNull
org.apache.log4j.Logger logger)
IQueryServicesIllegalArgumentException.
Use this method when callers are not likely to be using generics (i.e. legacy callers) and you need your own run time type checking.
This signature also writes an error to the log.
values - the input listtype - the expected type of each list element
public static <T> void ensureNonNullTypedElements(@NonNull
java.util.List<? extends T> values,
@NonNull
java.lang.Class<T> type,
@NonNull
java.lang.String listName)
IQueryServicesIllegalArgumentException.
Use this method when callers are not likely to be using generics (i.e. legacy callers) and you need your own run time type checking.
values - the input listtype - the expected type of each list elementlistName - the name of the input list
public static <T> void ensureNonNullTypedElements(@NonNull
java.util.List<? extends T> values,
@NonNull
java.lang.Class<T> type,
@NonNull
java.lang.String listName,
@NonNull
org.apache.log4j.Logger logger)
IQueryServicesIllegalArgumentException.
Use this method when callers are not likely to be using generics (i.e. legacy callers) and you need your own run time type checking.
This signature also writes an error to the log.
values - the input listtype - the expected type of each list elementlistName - the name of the input listlogger - log an error message to this loggerpublic static void checkExpression(boolean expression)
IQueryServicesIllegalArgumentException if the expression if false.
public static void checkExpression(boolean expression,
java.lang.String parameterName)
IQueryServicesIllegalArgumentException with a descriptive message
containing the input parameter name if the expression if false.
|
| Query |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||