FactoryRegistry

class FactoryRegistry


A registry of traits and device types to be used by the SDK.

Summary

Public constructors

Public functions

TraitFactory<Trait>
getTrait(traitId: String)

Returns the corresponding TraitFactory for the given traitId, eventId, or commandId.

TraitFactory<Trait>?

Returns the corresponding TraitFactory for the given traitId, eventId, or commandId, or null if FactoryRegistry was not initialized with the trait.

DeviceTypeFactory<DeviceType>
getType(typeId: String)

Returns the corresponding DeviceTypeFactory for the given typeId.

DeviceTypeFactory<DeviceType>?

Returns the corresponding DeviceTypeFactory for the given typeId, or null if FactoryRegistry was not initialized with the device type.

Public constructors

FactoryRegistry

FactoryRegistry(
    traits: List<TraitFactory<Trait>> = listOf(),
    types: List<DeviceTypeFactory<DeviceType>> = listOf()
)

Public functions

getTrait

fun getTrait(traitId: String): TraitFactory<Trait>

Returns the corresponding TraitFactory for the given traitId, eventId, or commandId.

Throws
com.google.home.HomeException

if FactoryRegistry was not initialized with the trait.

getTraitOrNull

fun getTraitOrNull(traitId: String): TraitFactory<Trait>?

Returns the corresponding TraitFactory for the given traitId, eventId, or commandId, or null if FactoryRegistry was not initialized with the trait.

getType

fun getType(typeId: String): DeviceTypeFactory<DeviceType>

Returns the corresponding DeviceTypeFactory for the given typeId.

Throws
com.google.home.HomeException

if FactoryRegistry was not initialized with the device type.

getTypeOrNull

fun getTypeOrNull(typeId: String): DeviceTypeFactory<DeviceType>?

Returns the corresponding DeviceTypeFactory for the given typeId, or null if FactoryRegistry was not initialized with the device type.