# GenericTraitProvider

# GenericTraitProvider


```
@HomeExperimentalGenericApi
class GenericTraitProvider : TraitProvider
```

<br />

*** ** * ** ***

## Summary

| ### Public constructors |
|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/GenericTraitProvider#GenericTraitProvider(kotlin.collections.Set)(genericTraits: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-set/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/GenericTrait>)` |

| ### Public functions |
|---|---|
| `open T?` | `<T : https://developers.home.google.com/reference/kotlin/com/google/home/Trait> https://developers.home.google.com/reference/kotlin/com/google/home/GenericTraitProvider#trait(com.google.home.TraitFactory)(traitFactory: https://developers.home.google.com/reference/kotlin/com/google/home/TraitFactory<T>)` Access a specific trait on the provider given a caller-provided TraitFactory. |
| `open https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-set/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/Trait>` | `https://developers.home.google.com/reference/kotlin/com/google/home/GenericTraitProvider#traits()()` Given a similar accessible trait set as the function above, returns a subset of those traits that are present in the associated `https://developers.home.google.com/reference/kotlin/com/google/home/HomeConfig#factoryRegistry()` union'ed with those already known to the extended sub-class (e.g specific DeviceType that is aware of the set of `https://developers.home.google.com/reference/kotlin/com/google/home/TraitFactory`s specified in its type definition). |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-set/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/GenericTrait>` | `https://developers.home.google.com/reference/kotlin/com/google/home/GenericTraitProvider#genericTraits()` |

| ### Inherited functions |
|---|
| From [com.google.home.TraitProvider](https://developers.home.google.com/reference/kotlin/com/google/home/TraitProvider) |---|---| | `open https://developers.home.google.com/reference/kotlin/com/google/home/Trait.TraitMetadata?` | `<T : https://developers.home.google.com/reference/kotlin/com/google/home/Trait> https://developers.home.google.com/reference/kotlin/com/google/home/TraitProvider#metadata(com.google.home.TraitFactory)(traitFactory: https://developers.home.google.com/reference/kotlin/com/google/home/TraitFactory<T>)` Access a specific trait metadata on the provider given a caller-provided TraitFactory. | |

## Public constructors

### GenericTraitProvider

```
GenericTraitProvider(genericTraits: Set<GenericTrait>)
```

## Public functions

### trait

```
open fun <T : Trait> trait(traitFactory: TraitFactory<T>): T?
```

Access a specific trait on the provider given a caller-provided TraitFactory. The accessible trait set can include traits that are not a part of the type definition but present on this function projection of the device (e.g utility / manufacturer-specific clusters)

### traits

```
open fun traits(): Set<Trait>
```

Given a similar accessible trait set as the function above, returns a subset of those traits that are present in the associated `https://developers.home.google.com/reference/kotlin/com/google/home/HomeConfig#factoryRegistry()` union'ed with those already known to the extended sub-class (e.g specific DeviceType that is aware of the set of `https://developers.home.google.com/reference/kotlin/com/google/home/TraitFactory`s specified in its type definition).

## Public properties

### genericTraits

```
val genericTraits: Set<GenericTrait>
```