今天在封装一个OkHttp的时候,看的代码,写入的。
下面是报错的情况
下面是HttpUtils里面的代码
//postDefault
public static <T extends BaseBean> void postDefault(HttpInterface httpInterface, String httpUrl, MapUtils mapUtils,
Class<T> mClass, @NonNull OKHttpListener<T> listener) {
if (mapUtils.get(KEY_USERID) == null) {
mapUtils.put(KEY_USERID, "用户id");
}
postCustom(httpInterface, httpUrl, RequestBody.create(mMediaType, mapUtils.toString()), null, mClass, listener);
}
下面是HttpUtils里面的代码段
//postDefault
public static <T extends BaseBean> void postDefault(HttpInterface httpInterface, String httpUrl, MapUtils mapUtils,
Class<T> mClass, @NonNull OKHttpListener<T> listener) {
if (mapUtils.get(KEY_USERID) == null) {
mapUtils.put(KEY_USERID, "用户id");
}
postCustom(httpInterface, httpUrl, RequestBody.create(mMediaType, mapUtils.toString()), null, mClass, listener);
}
这个在Class里面怎么调用呀?也不能用this