0

我有一个注释“AddHeader”的功能:

annotation class AddHeader

如果一个函数添加了这个注解,它会添加一个像这样的参数:

// service for retrofit
interface TestService {
    @AddHeader
    @Get("show")
    fun show(a: Int)
}

将改变:

// service for retrofit
interface TestService {
    @Get("show")
    fun show(@retrofit2.http.Header("custom_key") header : String = "", a: Int)
}

我不知道如何实现这个目标。请帮忙。

4

0 回答 0