docs/doc/reference/com/google/android/exoplayer2/util/Assertions.html
Package com.google.android.exoplayer2.util
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classAssertionsextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")
Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
Provides methods for asserting the truth of expressions and properties.
All Methods Static Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| static void | checkArgument(boolean expression) |
Deprecated.
Throws IllegalArgumentException if expression evaluates to false.
|
| static void | checkArgument(boolean expression, Object errorMessage) |
Deprecated.
Throws IllegalArgumentException if expression evaluates to false.
|
| static int | checkIndex(int index, int start, int limit) |
Deprecated.
Throws IndexOutOfBoundsException if index falls outside the specified bounds.
|
| static void | checkMainThread() |
Deprecated.
Throws IllegalStateException if the calling thread is not the application's main thread.
|
| static String | checkNotEmpty(String string) |
Deprecated.
Throws IllegalArgumentException if string is null or zero length.
|
| static String | checkNotEmpty(String string, Object errorMessage) |
Deprecated.
Throws IllegalArgumentException if string is null or zero length.
|
| static <T> T | checkNotNull(T reference) |
Deprecated.
Throws NullPointerException if reference is null.
|
| static <T> T | checkNotNull(T reference, Object errorMessage) |
Deprecated.
Throws NullPointerException if reference is null.
|
| static void | checkState(boolean expression) |
Deprecated.
Throws IllegalStateException if expression evaluates to false.
|
| static void | checkState(boolean expression, Object errorMessage) |
Deprecated.
Throws IllegalStateException if expression evaluates to false.
|
| static <T> T | checkStateNotNull(T reference) |
Deprecated.
Throws IllegalStateException if reference is null.
|
| static <T> T | checkStateNotNull(T reference, Object errorMessage) |
Deprecated.
Throws IllegalStateException if reference is null.
|
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
@Pure
public static void checkArgument(boolean expression)
Deprecated.
Throws IllegalArgumentException if expression evaluates to false.
Parameters:expression - The expression to evaluate.Throws:IllegalArgumentException - If expression is false.
-
@Pure
public static void checkArgument(boolean expression,[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")errorMessage)
Deprecated.
Throws IllegalArgumentException if expression evaluates to false.
Parameters:expression - The expression to evaluate.errorMessage - The exception message if an exception is thrown. The message is converted to a String using String.valueOf(Object).Throws:IllegalArgumentException - If expression is false.
-
@Pure
public static int checkIndex(int index,
int start,
int limit)
Deprecated.
Throws IndexOutOfBoundsException if index falls outside the specified bounds.
Parameters:index - The index to test.start - The start of the allowed range (inclusive).limit - The end of the allowed range (exclusive).Returns:The index that was validated.Throws:IndexOutOfBoundsException - If index falls outside the specified bounds.
-
@Pure
public static void checkState(boolean expression)
Deprecated.
Throws IllegalStateException if expression evaluates to false.
Parameters:expression - The expression to evaluate.Throws:IllegalStateException - If expression is false.
-
@Pure
public static void checkState(boolean expression,[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")errorMessage)
Deprecated.
Throws IllegalStateException if expression evaluates to false.
Parameters:expression - The expression to evaluate.errorMessage - The exception message if an exception is thrown. The message is converted to a String using String.valueOf(Object).Throws:IllegalStateException - If expression is false.
-
@EnsuresNonNull("#1")
@Pure
public static <T> T checkStateNotNull(@Nullable
T reference)
Deprecated.
Throws IllegalStateException if reference is null.
Type Parameters:T - The type of the reference.Parameters:reference - The reference.Returns:The non-null reference that was validated.Throws:IllegalStateException - If reference is null.
-
@EnsuresNonNull("#1")
@Pure
public static <T> T checkStateNotNull(@Nullable
T reference,[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")errorMessage)
Deprecated.
Throws IllegalStateException if reference is null.
Type Parameters:T - The type of the reference.Parameters:reference - The reference.errorMessage - The exception message to use if the check fails. The message is converted to a string using String.valueOf(Object).Returns:The non-null reference that was validated.Throws:IllegalStateException - If reference is null.
-
@EnsuresNonNull("#1")
@Pure
public static <T> T checkNotNull(@Nullable
T reference)
Deprecated.
Throws NullPointerException if reference is null.
Type Parameters:T - The type of the reference.Parameters:reference - The reference.Returns:The non-null reference that was validated.Throws:NullPointerException - If reference is null.
-
@EnsuresNonNull("#1")
@Pure
public static <T> T checkNotNull(@Nullable
T reference,[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")errorMessage)
Deprecated.
Throws NullPointerException if reference is null.
Type Parameters:T - The type of the reference.Parameters:reference - The reference.errorMessage - The exception message to use if the check fails. The message is converted to a string using String.valueOf(Object).Returns:The non-null reference that was validated.Throws:NullPointerException - If reference is null.
-
@EnsuresNonNull("#1")
@Pure
public static[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")checkNotEmpty(@Nullable[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")string)
Deprecated.
Throws IllegalArgumentException if string is null or zero length.
Parameters:string - The string to check.Returns:The non-null, non-empty string that was validated.Throws:IllegalArgumentException - If string is null or 0-length.
-
@EnsuresNonNull("#1")
@Pure
public static[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")checkNotEmpty(@Nullable[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")string,[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")errorMessage)
Deprecated.
Throws IllegalArgumentException if string is null or zero length.
Parameters:string - The string to check.errorMessage - The exception message to use if the check fails. The message is converted to a string using String.valueOf(Object).Returns:The non-null, non-empty string that was validated.Throws:IllegalArgumentException - If string is null or 0-length.
-
@Pure
public static void checkMainThread()
Deprecated.
Throws IllegalStateException if the calling thread is not the application's main thread.
Throws:IllegalStateException - If the calling thread is not the application's main thread.