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

com.github.kpavlov.jreactive8583.client.ClientConfiguration.kt Maven / Gradle / Ivy

There is a newer version: 1.5.1
Show newest version
@file:JvmName("ClientConfiguration")

package com.github.kpavlov.jreactive8583.client

import com.github.kpavlov.jreactive8583.ConnectorConfiguration

public open class ClientConfiguration(
    builder: Builder
) : ConnectorConfiguration(builder) {

    /**
     * Client reconnect interval in milliseconds.
     *
     * @return interval between reconnects, in milliseconds.
     */
    public val reconnectInterval: Int = builder.reconnectInterval

    public companion object {

        /**
         * Default client reconnect interval in milliseconds.
         */
        public const val DEFAULT_RECONNECT_INTERVAL: Int = 100

        @JvmStatic
        public fun newBuilder(): Builder = Builder()

        @Suppress("unused")
        @JvmStatic
        public fun getDefault(): ClientConfiguration = newBuilder().build()
    }

    @Suppress("unused")
    public data class Builder(
        var reconnectInterval: Int = DEFAULT_RECONNECT_INTERVAL
    ) : ConnectorConfiguration.Builder() {

        public fun reconnectInterval(reconnectInterval: Int): Builder =
            apply { this.reconnectInterval = reconnectInterval }

        public fun build(): ClientConfiguration = ClientConfiguration(this)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy