IviServiceHostBuilder

abstract class IviServiceHostBuilder

Base class for IviServiceHostBase builders.

An implementation builds an IviServiceHostBase instance.

To use an implementation in combination with the IVI Gradle plugin, the implementation class is required to be named 'Builder. The class is also required to have an (empty) companion object. This companion object` needs to exist to ensure extensions functions can be added to it.

Example

class ExampleServiceHostBuilder : IviServiceHostBuilder() {
override fun build(iviServiceHostContext: IviServiceHostContext) =
SimpleIviServiceHost(
setOf(
TestExampleService(iviServiceHostContext),
...
)

companion object
}

An IVI service host builder (ExampleServiceHostBuilder in this example) can be added to the IVI application by adding the IVI service host to the build.gradle.kts file that defines the IVI Application configuration, like this.

val exampleServiceHost = IviServiceHostConfig(
serviceHostBuilderName = "ExampleServiceHostBuilder",
...
)

ivi {
application {
enabled = true
service {
addHost(exampleServiceHost)
}
}
}

Constructors

Link copied to clipboard
fun IviServiceHostBuilder()

Functions

Link copied to clipboard
abstract fun build(iviServiceHostContext: IviServiceHostContext): IviServiceHostBase

Called to construct the IviServiceHostBase instance with the given iviServiceHostContext.

Link copied to clipboard

Sets the IviServiceHostIds for the service interface annotated with the IviDiscoverableService annotation. The service IDs are defined in the generated code based on the IVI gradle plugin configuration.

Inheritors

Link copied to clipboard