# Discouraged

Artifact: [androidx.annotation:annotation](https://developer.android.com/jetpack/androidx/releases/annotation) [View Source](https://cs.android.com/search?q=file:androidx/annotation/Discouraged.kt+class:androidx.annotation.Discouraged) Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/annotation#1.3.0)

*** ** * ** ***

Common/AllAndroid/JVM
- Cmn

  ```
  @Retention(value = AnnotationRetention.BINARY)
  @Target(allowedTargets = [AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FIELD, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.CLASS])
  annotation Discouraged
  ```

*** ** * ** ***

Denotes that the annotated element, while not disallowed or deprecated, is one that programmers are generally discouraged from using.

Example:

```kotlin
@Discouraged(message = "It is much more efficient to retrieve "
                       + "resources by identifier than by name.")
public void getValue(String name) {
    ...
}
```

## Summary

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/annotation/Discouraged#Discouraged(kotlin.String)(message: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` | Cmn |

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/annotation/Discouraged#message()` Defines the message to display when an element marked with this annotation is used. | Cmn |

## Public constructors

### Discouraged

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/annotation#1.10.0)

```
Discouraged(message: String)
```

## Public properties

### message

Cmn

```
val message: String
```

Defines the message to display when an element marked with this annotation is used. An alternative should be provided in the message.