Assertions
@UnstableApi
public final class Assertions
Provides methods for asserting the truth of expressions and properties.
Summary
Public methods |
|
|---|---|
static void |
@PureThis method is deprecated. Use checkArgument instead. |
static void |
@PureThis method is deprecated. Use checkArgument instead. |
static int |
@PureThis method is deprecated. Use |
static void |
@PureThis method is deprecated. Use checkState to assert |
static String |
@EnsuresNonNull(value = [""#1""])This method is deprecated. Use checkArgument with |
static String |
@EnsuresNonNull(value = [""#1""])This method is deprecated. Use checkArgument with |
static T |
@EnsuresNonNull(value = [""#1""])This method is deprecated. Use checkNotNull instead. |
static T |
@EnsuresNonNull(value = [""#1""])This method is deprecated. Use checkNotNull instead. |
static void |
@PureThis method is deprecated. Use checkState instead. |
static void |
@PureThis method is deprecated. Use checkState instead. |
static T |
@EnsuresNonNull(value = [""#1""])This method is deprecated. Use checkNotNull instead. |
static T |
@EnsuresNonNull(value = [""#1""])This method is deprecated. Use checkNotNull instead. |
Public methods
checkArgument
@Pure
@InlineMe(replacement = "Preconditions.checkArgument(expression)", imports = "com.google.common.base.Preconditions")
public static voidcheckArgument(boolean expression)
checkArgument
@Pure
@InlineMe(replacement = "Preconditions.checkArgument(expression, errorMessage)", imports = "com.google.common.base.Preconditions")
public static voidcheckArgument(boolean expression, Object errorMessage)
checkMainThread
@Pure
@InlineMe(replacement = "Preconditions.checkState(Looper.myLooper() == Looper.getMainLooper(), \"Not in" + " application's main thread\")", imports = [""com.google.common.base.Preconditions"", ""android.os.Looper""])
public static voidcheckMainThread()
checkNotEmpty
@EnsuresNonNull(value = [""#1""])
@Pure
public static StringcheckNotEmpty(@Nullable String string)
checkNotEmpty
@EnsuresNonNull(value = [""#1""])
@Pure
public static StringcheckNotEmpty(@Nullable String string, Object errorMessage)
checkNotNull
@EnsuresNonNull(value = [""#1""])
@Pure
@InlineMe(replacement = "Preconditions.checkNotNull(reference)", imports = "com.google.common.base.Preconditions")
public static T <T>checkNotNull(@Nullable T reference)
checkNotNull
@EnsuresNonNull(value = [""#1""])
@Pure
@InlineMe(replacement = "Preconditions.checkNotNull(reference, errorMessage)", imports = "com.google.common.base.Preconditions")
public static T <T>checkNotNull(@Nullable T reference, Object errorMessage)
checkState
@Pure
@InlineMe(replacement = "Preconditions.checkState(expression)", imports = "com.google.common.base.Preconditions")
public static voidcheckState(boolean expression)
checkState
@Pure
@InlineMe(replacement = "Preconditions.checkState(expression, errorMessage)", imports = "com.google.common.base.Preconditions")
public static voidcheckState(boolean expression, Object errorMessage)
checkStateNotNull
@EnsuresNonNull(value = [""#1""])
@Pure
@InlineMe(replacement = "Preconditions.checkNotNull(reference)", imports = "com.google.common.base.Preconditions")
public static T <T>checkStateNotNull(@Nullable T reference)
checkStateNotNull
@EnsuresNonNull(value = [""#1""])
@Pure
@InlineMe(replacement = "Preconditions.checkNotNull(reference, errorMessage)", imports = "com.google.common.base.Preconditions")
public static T <T>checkStateNotNull(@Nullable T reference, Object errorMessage)