models for Preconditions.checkArgument

Reviewed By: peterogithub

Differential Revision: D3383983

fbshipit-source-id: bb6a551
master
Jeremy Dubreil 9 years ago committed by Facebook Github Bot 2
parent 17da853fa8
commit a756b7bff2

@ -15,34 +15,49 @@ import static com.facebook.infer.models.InferBuiltins.assume;
public final class Preconditions {
public static <T> T checkNotNull(T reference) {
assume(reference != null);
return reference;
}
public static <T> T checkNotNull(T reference, @Nullable Object errorMessage) {
return checkNotNull(reference);
}
public static <T> T checkNotNull(T reference,
@Nullable String errorMessageTemplate,
@Nullable Object... errorMessageArgs) {
return checkNotNull(reference);
}
public static void checkState(boolean expression) {
assume(expression);
}
public static void checkState(boolean expression,
@Nullable Object errorMessage) {
assume(expression);
}
public static void checkState(boolean expression,
@Nullable String errorMessageTemplate,
@Nullable Object... errorMessageArgs) {
assume(expression);
}
public static <T> T checkNotNull(T reference) {
assume(reference != null);
return reference;
}
public static <T> T checkNotNull(T reference, @Nullable Object errorMessage) {
return checkNotNull(reference);
}
public static <T> T checkNotNull(T reference,
@Nullable String errorMessageTemplate,
@Nullable Object... errorMessageArgs) {
return checkNotNull(reference);
}
public static void checkState(boolean expression) {
assume(expression);
}
public static void checkState(boolean expression,
@Nullable Object errorMessage) {
assume(expression);
}
public static void checkState(boolean expression,
@Nullable String errorMessageTemplate,
@Nullable Object... errorMessageArgs) {
assume(expression);
}
public static void checkArgument(boolean expression) {
assume(expression);
}
public static void checkArgument(boolean expression, @Nullable Object errorMessage) {
assume(expression);
}
public static void checkArgument(
boolean expression,
@Nullable String errorMessageTemplate,
@Nullable Object... errorMessageArgs) {
assume(expression);
}
}

Loading…
Cancel
Save