Stay organized with collections
Save and categorize content based on your preferences.
public enum RequiresOptIn.Level extends Enum
Severity of the diagnostic that should be reported on usages of opt-in API which did not explicitly accept the opt-in aspect of that API either by:
- Propagating the opt-in aspect by annotating the usage with the marker annotation, thus
becoming part of the marked opt-in API surface or
- Suppressing propagation of the opt-in aspect by annotating the usage with [OptIn] and
specifying the marker annotation
Summary
Enum Values |
ERROR |
Specifies that an error should be reported on incorrect usages of this opt-in API.
|
WARNING |
Specifies that a warning should be reported on incorrect usages of this opt-in API.
|
Public methods |
final @NonNull EnumEntries<@NonNull RequiresOptIn.Level> |
Severity of the diagnostic that should be reported on usages of opt-in API which did not explicitly accept the opt-in aspect of that API either by:
|
final @NonNull RequiresOptIn.Level |
Returns the enum constant of this type with the specified name.
|
final @NonNull RequiresOptIn.Level[] |
Returns an array containing the constants of this enum type, in the order they're declared.
|
Public methods
public final @NonNull EnumEntries<@NonNull RequiresOptIn.Level> getEntries()
Severity of the diagnostic that should be reported on usages of opt-in API which did not explicitly accept the opt-in aspect of that API either by:
- Propagating the opt-in aspect by annotating the usage with the marker annotation, thus
becoming part of the marked opt-in API surface or
- Suppressing propagation of the opt-in aspect by annotating the usage with [OptIn] and
specifying the marker annotation
public final @NonNull RequiresOptIn.Level valueOf(@NonNull String value)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
public final @NonNull RequiresOptIn.Level[] values()
Returns an array containing the constants of this enum type, in the order they're declared.
This method may be used to iterate over the constants.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-05-15 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-15 UTC."],[],[],null,["# RequiresOptIn.Level\n===================\n\nArtifact: [androidx.annotation:annotation-experimental](/jetpack/androidx/releases/annotation) \n[View Source](https://cs.android.com/search?q=file:androidx/annotation/RequiresOptIn.kt+class:androidx.annotation.RequiresOptIn.Level) \nAdded in [1.1.0](/jetpack/androidx/releases/annotation#1.1.0)\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/androidx/annotation/RequiresOptIn.Level \"View this page in Kotlin\") \\|Java\n\n\n```\npublic enum RequiresOptIn.Level extends Enum\n```\n\n\u003cbr /\u003e\n\n|---|---|-----------------------------------------------------------------------------------------------|\n| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||\n| ↳ | [kotlin.Enum](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-enum/index.html) ||\n| | ↳ | [androidx.annotation.RequiresOptIn.Level](/reference/androidx/annotation/RequiresOptIn.Level) |\n\n*** ** * ** ***\n\nSeverity of the diagnostic that should be reported on usages of opt-in API which did not explicitly accept the opt-in aspect of that API either by:\n\n- Propagating the opt-in aspect by annotating the usage with the marker annotation, thus becoming part of the marked opt-in API surface *or*\n- Suppressing propagation of the opt-in aspect by annotating the usage with \\[OptIn\\] and specifying the marker annotation\n\n Summary\n -------\n\n | ### Enum Values |\n |-----------------------------------------------------------------------|-------------------------------------------------------------------------------------|\n | [ERROR](/reference/androidx/annotation/RequiresOptIn.Level#ERROR) | Specifies that an error should be reported on incorrect usages of this opt-in API. |\n | [WARNING](/reference/androidx/annotation/RequiresOptIn.Level#WARNING) | Specifies that a warning should be reported on incorrect usages of this opt-in API. |\n\n | ### Public methods |\n |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n | `final @`[NonNull](/reference/androidx/annotation/NonNull)` `[EnumEntries](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.enums/-enum-entries/index.html)`\u003c@`[NonNull](/reference/androidx/annotation/NonNull)` `[RequiresOptIn.Level](/reference/androidx/annotation/RequiresOptIn.Level)`\u003e` | [getEntries](/reference/androidx/annotation/RequiresOptIn.Level#getEntries())`()` Severity of the diagnostic that should be reported on usages of opt-in API which did not explicitly accept the opt-in aspect of that API either by: |\n | `final @`[NonNull](/reference/androidx/annotation/NonNull)` `[RequiresOptIn.Level](/reference/androidx/annotation/RequiresOptIn.Level) | [valueOf](/reference/androidx/annotation/RequiresOptIn.Level#valueOf(kotlin.String))`(@`[NonNull](/reference/androidx/annotation/NonNull)` `[String](https://developer.android.com/reference/java/lang/String.html)` value)` Returns the enum constant of this type with the specified name. |\n | `final @`[NonNull](/reference/androidx/annotation/NonNull)` RequiresOptIn.Level[]` | [values](/reference/androidx/annotation/RequiresOptIn.Level#values())`()` Returns an array containing the constants of this enum type, in the order they're declared. |\n\n Enum Values\n -----------\n\n ### ERROR\n\n ```\n RequiresOptIn.Level RequiresOptIn.Level.ERROR\n ```\n\n Specifies that an error should be reported on incorrect usages of this opt-in API. \n\n ### WARNING\n\n ```\n RequiresOptIn.Level RequiresOptIn.Level.WARNING\n ```\n\n Specifies that a warning should be reported on incorrect usages of this opt-in API. \n\n Public methods\n --------------\n\n ### getEntries\n\n ```\n public final @NonNull EnumEntries\u003c@NonNull RequiresOptIn.Level\u003e getEntries()\n ```\n\n Severity of the diagnostic that should be reported on usages of opt-in API which did not explicitly accept the opt-in aspect of that API either by:\n - Propagating the opt-in aspect by annotating the usage with the marker annotation, thus becoming part of the marked opt-in API surface *or*\n - Suppressing propagation of the opt-in aspect by annotating the usage with \\[OptIn\\] and specifying the marker annotation \n\n ### valueOf\n\n Added in [1.1.0](/jetpack/androidx/releases/annotation#1.1.0) \n\n ```\n public final @NonNull RequiresOptIn.Level valueOf(@NonNull String value)\n ```\n\n Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.) \n\n | Throws |\n |--------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------|\n | [kotlin.IllegalArgumentException](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html) | if this enum type has no constant with the specified name |\n\n ### values\n\n Added in [1.1.0](/jetpack/androidx/releases/annotation#1.1.0) \n\n ```\n public final @NonNull RequiresOptIn.Level[] values()\n ```\n\n Returns an array containing the constants of this enum type, in the order they're declared.\n\n This method may be used to iterate over the constants."]]