public class BaseEntity extends ApiResult implements Serializable {
/**
* 扩展字段
* 0:data为对象
* 1:data为集合
* 2:date为空或者null字段
*/
public int dataType;
public int getDataType() {
return dataType;
}
public void setDataType(int dataType) {
this.dataType = dataType;
}
public boolean isTokenLose(){
return getCode()== Constants.Code.ACCESS_TOKEN_EXPIRED;
}
}
/**
page 第几页
max_page 总页数
perpage 当前页的数量
total 总记录数
*/
class PagingEntity(var page: Int,
var max_page: Int,
var perpage: Int,
var total: Int,
var data: ArrayList?
) :Serializable
#######
父类统一处理:
fun load() {
subscribe = object : BaseSubscriber<PagingEntity<T>>() {
override fun onError(e: ApiException) {
}
override fun onNext(t: PagingEntity<T>) {
}
}
getRequest().subscribe(subscribe as BaseSubscriber<PagingEntity<T>>)
}
abstract fun getRequest(): io.reactivex.Observable<PagingEntity<T>>
我想把分页信息单独抽出来 传入泛型 然后解析不了报错
public class BaseEntity extends ApiResult implements Serializable {
}
/**
####### 父类统一处理:
########
子类实现接口
######################################################
{ "code": 0, "data": { "page": 1, "perpage": 20, "max_page": 1, "has_more": true, "total": "2", "data": [ { "name": "12312", "birth_year": "2004"
}