# GenericPartsProvider

# GenericPartsProvider


```
@HomeExperimentalGenericApi
class GenericPartsProvider : HasParts
```

<br />

*** ** * ** ***

## Summary

| ### Public constructors |
|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/GenericPartsProvider#GenericPartsProvider()()` |

| ### Public functions |
|---|---|
| `open T` | `<T : https://developers.home.google.com/reference/kotlin/com/google/home/DeviceType> https://developers.home.google.com/reference/kotlin/com/google/home/GenericPartsProvider#part(com.google.home.DeviceTypeFactory,kotlin.Array)(type: https://developers.home.google.com/reference/kotlin/com/google/home/DeviceTypeFactory<T>, vararg tags: https://developers.home.google.com/reference/kotlin/com/google/home/Tag)` Returns the first part that matches the given type and tags. |
| `open T?` | `<T : https://developers.home.google.com/reference/kotlin/com/google/home/DeviceType> https://developers.home.google.com/reference/kotlin/com/google/home/GenericPartsProvider#partOrNull(com.google.home.DeviceTypeFactory,kotlin.Array)(type: https://developers.home.google.com/reference/kotlin/com/google/home/DeviceTypeFactory<T>, vararg tags: https://developers.home.google.com/reference/kotlin/com/google/home/Tag)` Returns the first part that matches the given type and tags. |

| ### Public properties |
|---|---|
| `open https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-set/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/DeviceType>` | `https://developers.home.google.com/reference/kotlin/com/google/home/GenericPartsProvider#parts()` The parts of this object represented as a set of device types. |

## Public constructors

### GenericPartsProvider

```
GenericPartsProvider()
```

## Public functions

### part

```
open fun <T : DeviceType> part(type: DeviceTypeFactory<T>, vararg tags: Tag): T
```

Returns the first part that matches the given type and tags. If no part matches, this method will throw a `https://developers.home.google.com/reference/kotlin/com/google/home/HomeException`. If there are multiple parts that match, this method will throw a `https://developers.home.google.com/reference/kotlin/com/google/home/HomeException` with error code `https://developers.home.google.com/reference/kotlin/com/google/home/HomeException.Codes#INVALID_ARGUMENT()`.

### partOrNull

```
open fun <T : DeviceType> partOrNull(type: DeviceTypeFactory<T>, vararg tags: Tag): T?
```

Returns the first part that matches the given type and tags. If no part matches, this method will return null.

## Public properties

### parts

```
open val parts: Set<DeviceType>
```

The parts of this object represented as a set of device types.