public final class Preconditions
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static void |
checkArgument(boolean expression)
Ensures the truth of an expression involving one or more parameters to the calling method.
|
static void |
checkArgument(boolean expression,
java.lang.String message)
Ensures the truth of an expression involving one or more parameters to the calling method.
|
static void |
checkArgument(boolean expression,
java.lang.String message,
com.palantir.logsafe.Arg<?>... args)
Ensures the truth of an expression involving one or more parameters to the calling method.
|
static void |
checkArgument(boolean expression,
java.lang.String message,
com.palantir.logsafe.Arg<?> arg)
Ensures the truth of an expression involving one or more parameters to the calling method.
|
static void |
checkArgument(boolean expression,
java.lang.String message,
com.palantir.logsafe.Arg<?> arg1,
com.palantir.logsafe.Arg<?> arg2)
Ensures the truth of an expression involving one or more parameters to the calling method.
|
static void |
checkArgument(boolean expression,
java.lang.String message,
com.palantir.logsafe.Arg<?> arg1,
com.palantir.logsafe.Arg<?> arg2,
com.palantir.logsafe.Arg<?> arg3)
Ensures the truth of an expression involving one or more parameters to the calling method.
|
static <T> T |
checkNotNull(T reference)
Ensures that an Object reference passed as a parameter to the calling method is not null.
|
static <T> T |
checkNotNull(T reference,
java.lang.String message)
Ensures that an Object reference passed as a parameter to the calling method is not null.
|
static <T> T |
checkNotNull(T reference,
java.lang.String message,
com.palantir.logsafe.Arg<?>... args)
Ensures that an Object reference passed as a parameter to the calling method is not null.
|
static <T> T |
checkNotNull(T reference,
java.lang.String message,
com.palantir.logsafe.Arg<?> arg)
Ensures that an Object reference passed as a parameter to the calling method is not null.
|
static <T> T |
checkNotNull(T reference,
java.lang.String message,
com.palantir.logsafe.Arg<?> arg1,
com.palantir.logsafe.Arg<?> arg2)
Ensures that an Object reference passed as a parameter to the calling method is not null.
|
static <T> T |
checkNotNull(T reference,
java.lang.String message,
com.palantir.logsafe.Arg<?> arg1,
com.palantir.logsafe.Arg<?> arg2,
com.palantir.logsafe.Arg<?> arg3)
Ensures that an Object reference passed as a parameter to the calling method is not null.
|
static void |
checkState(boolean expression)
Ensures the truth of an expression involving the state of the calling instance, but not
involving any parameters to the calling method.
|
static void |
checkState(boolean expression,
java.lang.String message)
Ensures the truth of an expression involving the state of the calling instance, but not
involving any parameters to the calling method.
|
static void |
checkState(boolean expression,
java.lang.String message,
com.palantir.logsafe.Arg<?>... args)
Ensures the truth of an expression involving the state of the calling instance, but not
involving any parameters to the calling method.
|
static void |
checkState(boolean expression,
java.lang.String message,
com.palantir.logsafe.Arg<?> arg)
Ensures the truth of an expression involving one or more parameters to the calling method.
|
static void |
checkState(boolean expression,
java.lang.String message,
com.palantir.logsafe.Arg<?> arg1,
com.palantir.logsafe.Arg<?> arg2)
Ensures the truth of an expression involving one or more parameters to the calling method.
|
static void |
checkState(boolean expression,
java.lang.String message,
com.palantir.logsafe.Arg<?> arg1,
com.palantir.logsafe.Arg<?> arg2,
com.palantir.logsafe.Arg<?> arg3)
Ensures the truth of an expression involving one or more parameters to the calling method.
|
public static void checkArgument(boolean expression)
expression - a boolean expressionSafeIllegalArgumentException - if expression is falsepublic static void checkArgument(boolean expression,
@CompileTimeConstant
java.lang.String message)
expression - a boolean expressionmessage - the loggable exception messageSafeIllegalArgumentException - if expression is falsepublic static void checkArgument(boolean expression,
@CompileTimeConstant
java.lang.String message,
com.palantir.logsafe.Arg<?> arg)
See checkArgument(boolean, String, Arg...) for details.
public static void checkArgument(boolean expression,
@CompileTimeConstant
java.lang.String message,
com.palantir.logsafe.Arg<?> arg1,
com.palantir.logsafe.Arg<?> arg2)
See checkArgument(boolean, String, Arg...) for details.
public static void checkArgument(boolean expression,
@CompileTimeConstant
java.lang.String message,
com.palantir.logsafe.Arg<?> arg1,
com.palantir.logsafe.Arg<?> arg2,
com.palantir.logsafe.Arg<?> arg3)
See checkArgument(boolean, String, Arg...) for details.
public static void checkArgument(boolean expression,
@CompileTimeConstant
java.lang.String message,
com.palantir.logsafe.Arg<?>... args)
expression - a boolean expressionmessage - the loggable exception messageargs - the arguments to include in the SafeIllegalArgumentExceptionSafeIllegalArgumentException - if expression is falsepublic static void checkState(boolean expression)
expression - a boolean expressionSafeIllegalStateException - if expression is falsepublic static void checkState(boolean expression,
@CompileTimeConstant
java.lang.String message)
expression - a boolean expressionmessage - the loggable exception messageSafeIllegalStateException - if expression is falsepublic static void checkState(boolean expression,
@CompileTimeConstant
java.lang.String message,
com.palantir.logsafe.Arg<?> arg)
See checkState(boolean, String, Arg...) for details.
public static void checkState(boolean expression,
@CompileTimeConstant
java.lang.String message,
com.palantir.logsafe.Arg<?> arg1,
com.palantir.logsafe.Arg<?> arg2)
See checkState(boolean, String, Arg...) for details.
public static void checkState(boolean expression,
@CompileTimeConstant
java.lang.String message,
com.palantir.logsafe.Arg<?> arg1,
com.palantir.logsafe.Arg<?> arg2,
com.palantir.logsafe.Arg<?> arg3)
See checkState(boolean, String, Arg...) for details.
public static void checkState(boolean expression,
@CompileTimeConstant
java.lang.String message,
com.palantir.logsafe.Arg<?>... args)
expression - a boolean expressionmessage - the loggable exception messageargs - the arguments to include in the SafeIllegalStateExceptionSafeIllegalStateException - if expression is false@CanIgnoreReturnValue
public static <T> T checkNotNull(@Nullable
T reference)
reference - an String referenceSafeNullPointerException - if reference is null@CanIgnoreReturnValue
public static <T> T checkNotNull(@Nullable
T reference,
@CompileTimeConstant
java.lang.String message)
reference - an String referencemessage - the loggable exception messageSafeNullPointerException - if reference is null@CanIgnoreReturnValue
public static <T> T checkNotNull(@Nullable
T reference,
@CompileTimeConstant
java.lang.String message,
com.palantir.logsafe.Arg<?> arg)
See checkNotNull(Object, String, Arg...) for details.
@CanIgnoreReturnValue
public static <T> T checkNotNull(@Nullable
T reference,
@CompileTimeConstant
java.lang.String message,
com.palantir.logsafe.Arg<?> arg1,
com.palantir.logsafe.Arg<?> arg2)
See checkNotNull(Object, String, Arg...) for details.
@CanIgnoreReturnValue
public static <T> T checkNotNull(@Nullable
T reference,
@CompileTimeConstant
java.lang.String message,
com.palantir.logsafe.Arg<?> arg1,
com.palantir.logsafe.Arg<?> arg2,
com.palantir.logsafe.Arg<?> arg3)
See checkNotNull(Object, String, Arg...) for details.
@CanIgnoreReturnValue
public static <T> T checkNotNull(@Nullable
T reference,
@CompileTimeConstant
java.lang.String message,
com.palantir.logsafe.Arg<?>... args)
reference - an String referencemessage - the loggable exception messageargs - the arguments to include in the SafeNullPointerExceptionSafeNullPointerException - if reference is null