# AppFunctionOneOfTypeMetadata

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

*** ** * ** ***


```
class AppFunctionOneOfTypeMetadata : AppFunctionDataTypeMetadata
```

<br />

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.appfunctions.metadata.AppFunctionDataTypeMetadata](https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionDataTypeMetadata) ||
|   | ↳ | [androidx.appfunctions.metadata.AppFunctionOneOfTypeMetadata](https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionOneOfTypeMetadata) |

*** ** * ** ***

Defines the schema for a data type that can be one of several possible types, representing a form of polymorphism or a sealed hierarchy.

An object of this type must match exactly one of the schemas defined in the `https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionOneOfTypeMetadata#matchOneOf()` list. This is useful for modeling sealed classes or interfaces where an object can be one of a limited set of subtypes. This implies a hierarchical relationship between the parent type (represented by this `OneOfTypeMetadata`) and its possible concrete implementations in `https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionOneOfTypeMetadata#matchOneOf()`.

For example, consider the following sealed interface and its implementations:

```kotlin
package com.example.myapp

sealed interface Animal {
    val name: String
}

data class Dog(
    override val name: String,
    val breed: String,
) : Animal

data class Cat(
    override val name: String,
    val livesLeft: Int,
) : Animal
```

The following `https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionOneOfTypeMetadata` can be used to define a data type that matches any object implementing the `Animal` interface (i.e., either a `Dog` or a `Cat`).

```kotlin
val animalType = AppFunctionOneOfTypeMetadata(
    qualifiedName = "com.example.myapp.Animal",
    matchOneOf = listOf(
        AppFunctionObjectTypeMetadata(
            qualifiedName = "com.example.myapp.Dog",
            properties = mapOf(
                "name" to AppFunctionStringTypeMetadata(...),
                "breed" to AppFunctionStringTypeMetadata(...),
            ),
            required = listOf("name", "breed"),
            isNullable = false,
        ),
        AppFunctionObjectTypeMetadata(
            qualifiedName = "com.example.myapp.Cat",
            properties = mapOf(
                "name" to AppFunctionStringTypeMetadata(...),
                "livesLeft" to AppFunctionIntTypeMetadata(...),
            ),
            required = listOf("name", "livesLeft"),
            isNullable = false,
        ),
    ),
    isNullable = false,
)
```

This data type can be used to define the schema of an input or output type.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionOneOfTypeMetadata#AppFunctionOneOfTypeMetadata(kotlin.collections.List,kotlin.String,kotlin.Boolean,kotlin.String)( matchOneOf: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionDataTypeMetadata>, qualifiedName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, isNullable: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, description: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html )` |

| ### Public functions |
|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionOneOfTypeMetadata#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionOneOfTypeMetadata#hashCode()()` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionOneOfTypeMetadata#toString()()` |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionDataTypeMetadata>` | `https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionOneOfTypeMetadata#matchOneOf()` The list of possible data types that an object can match. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionOneOfTypeMetadata#qualifiedName()` The parent object's qualified name if available. |

### Inherited properties

From [androidx.appfunctions.metadata.AppFunctionDataTypeMetadata](https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionDataTypeMetadata) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionDataTypeMetadata#description()`

A description of the data type and its intended use.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionDataTypeMetadata#isNullable()`

Whether the data type is nullable.

## Public constructors

### AppFunctionOneOfTypeMetadata

```
AppFunctionOneOfTypeMetadata(
    matchOneOf: List<AppFunctionDataTypeMetadata>,
    qualifiedName: String,
    isNullable: Boolean,
    description: String = ""
)
```

## Public functions

### equals

```
open operator fun equals(other: Any?): Boolean
```

### hashCode

```
open fun hashCode(): Int
```

### toString

```
open fun toString(): String
```

## Public properties

### matchOneOf

Added in [1.0.0-rc01](https://developer.android.com/jetpack/androidx/releases/appfunctions#1.0.0-rc01)

```
val matchOneOf: List<AppFunctionDataTypeMetadata>
```

The list of possible data types that an object can match.

### qualifiedName

Added in [1.0.0-rc01](https://developer.android.com/jetpack/androidx/releases/appfunctions#1.0.0-rc01)

```
val qualifiedName: String
```

The parent object's qualified name if available. For example, "com.example.myapp.Animal".

Use this value to set `https://developer.android.com/reference/kotlin/androidx/appfunctions/AppFunctionData#qualifiedName()` when trying to build the parameters for `https://developer.android.com/reference/kotlin/androidx/appfunctions/ExecuteAppFunctionRequest`.