commonMain.com.copperleaf.ballast.debugger.versions.CompositeModelConverter.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ballast-debugger-server-jvm Show documentation
Show all versions of ballast-debugger-server-jvm Show documentation
Ktor websocket server for building Ballast Debugger UI
package com.copperleaf.ballast.debugger.versions
public open class CompositeModelConverter<
EventVersionA,
EventVersionB,
EventVersionC,
ActionVersionA,
ActionVersionB,
ActionVersionC
>(
private val converter1To2: ClientModelConverter<
EventVersionA,
EventVersionB,
ActionVersionA,
ActionVersionB
>,
private val converter2To3: ClientModelConverter<
EventVersionB,
EventVersionC,
ActionVersionB,
ActionVersionC
>,
) : ClientModelConverter<
EventVersionA,
EventVersionC,
ActionVersionA,
ActionVersionC
> {
override fun mapEvent(event: EventVersionA): EventVersionC {
val eventA: EventVersionA = event
val eventB: EventVersionB = converter1To2.mapEvent(eventA)
val eventC: EventVersionC = converter2To3.mapEvent(eventB)
return eventC
}
override fun mapAction(action: ActionVersionC): ActionVersionA {
val actionC: ActionVersionC = action
val actionB: ActionVersionB = converter2To3.mapAction(actionC)
val actionA: ActionVersionA = converter1To2.mapAction(actionB)
return actionA
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy