You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
903 B
Kotlin
41 lines
903 B
Kotlin
package me.eater.hefbrug.dsl.context.impl
|
|
|
|
import me.eater.hefbrug.definition.impl.ServiceDefinition
|
|
import me.eater.hefbrug.dsl.context.*
|
|
import me.eater.hefbrug.state.impl.ServiceState
|
|
|
|
class ServiceContext(definition: ServiceDefinition) : DefinitionContext<ServiceState>(definition),
|
|
Emitter by EmitterContext(), Listener by ListenerContext() {
|
|
|
|
var name: String by proxy(state::name)
|
|
|
|
val enabled: Unit
|
|
get() {
|
|
state.enabled = true
|
|
}
|
|
|
|
val running: Unit
|
|
get() {
|
|
state.running = true
|
|
}
|
|
|
|
val stopped: Unit
|
|
get() {
|
|
state.running = false
|
|
}
|
|
|
|
val disabled: Unit
|
|
get() {
|
|
state.enabled = false
|
|
}
|
|
|
|
val autostart: Unit
|
|
get() {
|
|
state.autostart = true
|
|
}
|
|
|
|
val noAutostart: Unit
|
|
get() {
|
|
state.autostart = false
|
|
}
|
|
} |