# AppFunctionIntValueConstraint

Artifact: [androidx.appfunctions:appfunctions](https://developer.android.com/jetpack/androidx/releases/appfunctions) [View Source](https://cs.android.com/search?q=file:androidx/appfunctions/AppFunctionIntValueConstraint.kt+class:androidx.appfunctions.AppFunctionIntValueConstraint) Added in [1.0.0-rc01](https://developer.android.com/jetpack/androidx/releases/appfunctions#1.0.0-rc01)

*** ** * ** ***


```
@Retention(value = AnnotationRetention.BINARY)
@Target(allowedTargets = [AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.VALUE_PARAMETER])
public annotation AppFunctionIntValueConstraint
```

<br />

*** ** * ** ***

Specifies constraints applied on the integer values for return types, parameters, or properties in app functions.

This annotation can be applied to:

- functions annotated with `@AppFunctionDeclaration` (to constrain the return value),

- parameters of `@AppFunctionDeclaration`,

- or properties within an `@AppFunctionSerializable`.

### Usage Example:

```
// Constraining a function return value:
@AppFunctionDeclaration(isDescribedByKDoc = false)
@AppFunctionIntValueConstraint(enumValues = [0, 1, 2])
fun getDisplayMode(): Int {
    // Function body
}

// Constraining a parameter:
@AppFunctionDeclaration(isDescribedByKDoc = false)
fun adjustVolume(
    @AppFunctionIntValueConstraint(enumValues = [10, 15, 20, 25])
    volumeLevel: Int
) {
    // Function body
}

// Constraining a property within an AppFunctionSerializable:
@AppFunctionSerializable(isDescribedByKDoc = false)
data class MySettings(
    @property:AppFunctionIntValueConstraint(enumValues = [0, 1])
    val darkMode: Int
)
```

## Summary

| ### Public methods |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull int[]` | `https://developer.android.com/reference/androidx/appfunctions/AppFunctionIntValueConstraint#getEnumValues()()` The list of allowed integer values for the annotated element. |

## Public methods

### getEnumValues

```
public final @NonNull int[] getEnumValues()
```

The list of allowed integer values for the annotated element.

These values are communicated to the agent or framework that interprets or invokes the `@AppFunctionDeclaration`. If any of the values carry special meaning (e.g., `0` means "off", `1` means "on"), such meanings should be documented clearly in the corresponding property, parameter, or function return KDoc.