RequiresFeature

  • Cmn
    @Retention(value = AnnotationRetention.SOURCE)
    @Target(allowedTargets = [AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.CLASS, AnnotationTarget.FIELD, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.CONSTRUCTOR])
    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

RequiresFeature(name: String, enforcement: String)
Cmn

Public 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.

Cmn
String

The name of the feature that is required.

Cmn

Public constructors

RequiresFeature

RequiresFeature(name: String, enforcement: String)

Public properties

enforcement

val enforcementString

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.

name

val nameString

The name of the feature that is required.