internal api refactoring
This commit is contained in:
parent
08982dcd3e
commit
3f8d62ebc4
@ -28,5 +28,6 @@ kotlin {
|
|||||||
dependencies{
|
dependencies{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
val nativeMain by getting{}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -28,7 +28,7 @@ class ActionDelegate<D : DeviceBase>(
|
|||||||
) : ReadOnlyProperty<D, Action> {
|
) : ReadOnlyProperty<D, Action> {
|
||||||
override fun getValue(thisRef: D, property: KProperty<*>): Action {
|
override fun getValue(thisRef: D, property: KProperty<*>): Action {
|
||||||
val name = property.name
|
val name = property.name
|
||||||
return owner.resolveAction(name) {
|
return owner.registerAction(name) {
|
||||||
SimpleAction(name, ActionDescriptor(name).apply(descriptorBuilder), block)
|
SimpleAction(name, ActionDescriptor(name).apply(descriptorBuilder), block)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,11 +33,11 @@ abstract class DeviceBase : Device {
|
|||||||
override val actionDescriptors: Collection<ActionDescriptor>
|
override val actionDescriptors: Collection<ActionDescriptor>
|
||||||
get() = actions.values.map { it.descriptor }
|
get() = actions.values.map { it.descriptor }
|
||||||
|
|
||||||
internal fun resolveProperty(name: String, builder: () -> ReadOnlyDeviceProperty): ReadOnlyDeviceProperty {
|
internal fun registerProperty(name: String, builder: () -> ReadOnlyDeviceProperty): ReadOnlyDeviceProperty {
|
||||||
return properties.getOrPut(name, builder)
|
return properties.getOrPut(name, builder)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun resolveAction(name: String, builder: () -> Action): Action {
|
internal fun registerAction(name: String, builder: () -> Action): Action {
|
||||||
return actions.getOrPut(name, builder)
|
return actions.getOrPut(name, builder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ private class ReadOnlyDevicePropertyDelegate<D : DeviceBase>(
|
|||||||
override fun getValue(thisRef: D, property: KProperty<*>): IsolatedReadOnlyDeviceProperty {
|
override fun getValue(thisRef: D, property: KProperty<*>): IsolatedReadOnlyDeviceProperty {
|
||||||
val name = property.name
|
val name = property.name
|
||||||
|
|
||||||
return owner.resolveProperty(name) {
|
return owner.registerProperty(name) {
|
||||||
@OptIn(ExperimentalCoroutinesApi::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
IsolatedReadOnlyDeviceProperty(
|
IsolatedReadOnlyDeviceProperty(
|
||||||
name,
|
name,
|
||||||
@ -186,7 +186,7 @@ private class DevicePropertyDelegate<D : DeviceBase>(
|
|||||||
|
|
||||||
override fun getValue(thisRef: D, property: KProperty<*>): IsolatedDeviceProperty {
|
override fun getValue(thisRef: D, property: KProperty<*>): IsolatedDeviceProperty {
|
||||||
val name = property.name
|
val name = property.name
|
||||||
return owner.resolveProperty(name) {
|
return owner.registerProperty(name) {
|
||||||
@OptIn(ExperimentalCoroutinesApi::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
IsolatedDeviceProperty(
|
IsolatedDeviceProperty(
|
||||||
name,
|
name,
|
||||||
|
Loading…
Reference in New Issue
Block a user