RequiresFeature
@Target([AnnotationTarget.CLASS, AnnotationTarget.FILE, AnnotationTarget.FIELD, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.CONSTRUCTOR]) class RequiresFeature
androidx.annotation.RequiresFeature |
Denotes that the annotated element requires one or more features. This is used to auto-generate documentation, and more importantly: to ensure correct usage in application code, where lint and Android Studio can check that calls marked with this annotation is surrounded by has-feature calls, referenced via the RequiresFeature#enforcement()
attribute.
Summary
Public constructors | |
---|---|
Denotes that the annotated element requires one or more features. |
Properties | |
---|---|
String |
Defines the name of the method that should be called to check whether the feature is available, using the same signature format as javadoc. |
String |
The name of the feature that is required. |
Public constructors
<init>
RequiresFeature(
name: String,
enforcement: String)
Denotes that the annotated element requires one or more features. This is used to auto-generate documentation, and more importantly: to ensure correct usage in application code, where lint and Android Studio can check that calls marked with this annotation is surrounded by has-feature calls, referenced via the RequiresFeature#enforcement()
attribute.
Properties
enforcement
val enforcement: String
Defines the name of the method that should be called to check whether the feature is available, using the same signature format as javadoc. The feature checking method can have multiple parameters, but the feature name parameter must be of type String and must also be the first String-type parameter.