desc:双参数构造实现样例

author:wangyimiao
master
yimiao 3 years ago
parent d3b18c3395
commit 72f4d5a2be

@ -9,8 +9,9 @@ import retrofit2.http.GET
import retrofit2.http.Headers import retrofit2.http.Headers
import retrofit2.http.Path import retrofit2.http.Path
class CollectionLoader(interceptors: List<Interceptor>) : class CollectionLoader : BaseObserve<CollectionLoader.CollectionApi> {
BaseObserve<CollectionLoader.CollectionApi>(CollectionApi::class.java, interceptors) { constructor() : super(CollectionApi::class.java)
constructor(interceptors: List<Interceptor>) : super(CollectionApi::class.java, interceptors)
fun getCollections(pageName: Int, callBack: RequestCallBack<CollectionResponse>) { fun getCollections(pageName: Int, callBack: RequestCallBack<CollectionResponse>) {
observe(api?.getCollections(pageName), callBack) observe(api?.getCollections(pageName), callBack)

@ -37,6 +37,13 @@ open class BaseObserve<T> {
api = RequestManager.create(clazz, interceptors) api = RequestManager.create(clazz, interceptors)
} }
/**
* 提供方法给外部获取API
*/
fun getAPI(): T? {
return api
}
/** /**
* 初始化服务类 * 初始化服务类
*/ */

Loading…
Cancel
Save