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

com.gojek.courier.StreamAdapter.kt Maven / Gradle / Ivy

There is a newer version: 0.3.1
Show newest version
package com.gojek.courier

import java.lang.reflect.Type

/**
 * Adapts a [Stream] into another type.
 */
interface StreamAdapter {

    /**
     * Returns an object that delegates to [stream].
     */
    fun adapt(stream: Stream): R

    /**
     * Creates [MessageAdapter] instances based on the return type of [the service interface][Courier.create] methods.
     */
    interface Factory {

        /**
         * Returns a [StreamAdapter] for adapting an [type] into another type, throws an exception if [type] cannot be
         * handled by this factory.
         */
        fun create(type: Type): StreamAdapter
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy