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

com.pubnub.internal.endpoints.DelegatingEndpoint.kt Maven / Gradle / Ivy

Go to download

PubNub is a cross-platform client-to-client (1:1 and 1:many) push service in the cloud, capable of broadcasting real-time messages to millions of web and mobile clients simultaneously, in less than a quarter second!

There is a newer version: 10.3.2
Show newest version
package com.pubnub.internal.endpoints

import com.pubnub.api.endpoints.Endpoint
import com.pubnub.api.endpoints.remoteaction.ExtendedRemoteAction
import com.pubnub.api.v2.PNConfiguration
import com.pubnub.internal.EndpointInterface
import com.pubnub.internal.PubNubCore

abstract class DelegatingEndpoint(pubnub: PubNubCore) : DelegatingRemoteAction(pubnub), Endpoint {
    override val remoteAction: ExtendedRemoteAction by lazy {
        val newAction = createAction()
        overrideConfiguration?.let { overrideConfigNonNull ->
            newAction.overrideConfiguration(overrideConfigNonNull)
        }
        mapResult(newAction)
    }
    private var overrideConfiguration: PNConfiguration? = null

    override fun overrideConfiguration(configuration: PNConfiguration): Endpoint {
        this.overrideConfiguration = configuration
        return this
    }

    abstract override fun createAction(): EndpointInterface
}

abstract class IdentityMappingEndpoint(pubnub: PubNubCore) : DelegatingEndpoint(pubnub) {
    final override fun mapResult(action: ExtendedRemoteAction): ExtendedRemoteAction {
        return action
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy