commonMain.com.copperleaf.ballast.debugger.versions.CompositeModelSerializer.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 CompositeModelSerializer<
EventLowerVersion,
EventHigherVersion,
ActionLowerVersion,
ActionHigherVersion
>(
private val serializer: ClientModelSerializer,
private val converter: ClientModelConverter,
) : ClientModelSerializer {
override val supported: Boolean = serializer.supported
override fun mapIncoming(incoming: String): EventHigherVersion {
val eventAtLowerVersion: EventLowerVersion = serializer.mapIncoming(incoming)
val eventAtHigherVersion: EventHigherVersion = converter.mapEvent(eventAtLowerVersion)
return eventAtHigherVersion
}
override fun mapOutgoing(outgoing: ActionHigherVersion): String {
val actionAtLowerVersion: ActionLowerVersion = converter.mapAction(outgoing)
val serializedToLowerVersion: String = serializer.mapOutgoing(actionAtLowerVersion)
return serializedToLowerVersion
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy