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

remote.ContractId.kt Maven / Gradle / Ivy

There is a newer version: 66.0.0
Show newest version
package ch.softappeal.yass.remote

import ch.softappeal.yass.OnlyNeededForJava

class ContractId @PublishedApi internal constructor(val contract: Class, val id: Int, val methodMapper: MethodMapper)

inline fun  contractId(id: Int, methodMapperFactory: MethodMapperFactory): ContractId =
    ContractId(C::class.java, id, methodMapperFactory(C::class.java))

@OnlyNeededForJava
fun  contractId(contract: Class, id: Int, methodMapperFactory: MethodMapperFactory): ContractId =
    ContractId(contract, id, methodMapperFactory(contract))

abstract class Services protected constructor(val methodMapperFactory: MethodMapperFactory) {
    @PublishedApi
    internal val identifiers = mutableSetOf()

    @OnlyNeededForJava
    protected fun  contractId(contract: Class, id: Int): ContractId {
        require(identifiers.add(id)) { "service with id $id already added" }
        return contractId(contract, id, methodMapperFactory)
    }

    protected inline fun  contractId(id: Int): ContractId =
        contractId(C::class.java, id)
}

abstract class AbstractInvocation internal constructor(val methodMapping: MethodMapping, val arguments: List) {
    @Volatile
    var context: Any? = null
}

interface AsyncInterceptor {
    @Throws(Exception::class)
    fun entry(invocation: AbstractInvocation)

    @Throws(Exception::class)
    fun exit(invocation: AbstractInvocation, result: Any?)

    @Throws(Exception::class)
    fun exception(invocation: AbstractInvocation, exception: Exception)
}

val DirectAsyncInterceptor = object : AsyncInterceptor {
    override fun entry(invocation: AbstractInvocation) {}
    override fun exit(invocation: AbstractInvocation, result: Any?) {}
    override fun exception(invocation: AbstractInvocation, exception: Exception) {}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy