All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.copperleaf.ballast.debugger.versions.CompositeModelSerializer.kt Maven / Gradle / Ivy

There is a newer version: 4.2.1
Show newest version
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