工作空间 v3.6.5.2版本的 MD5 值为:58e65af156c65a63bf64ed2e64960853
以下内容为反编译后的 ZRetrofit.java 源代码,内容仅作参考
package com.zhizhangyi.platform.network;
import com.google.gson.TypeAdapter;
import com.zhizhangyi.platform.common.utils.Singleton;
import com.zhizhangyi.platform.network.gson.GsonConverterFactory;
import com.zhizhangyi.platform.network.gson.JsonUtil;
import java.util.concurrent.Executor;
import okhttp3.HttpUrl;
import retrofit2.e;
import retrofit2.w;
public class ZRetrofit {
public static final String TAG = "httpLog:retrofit";
private static final Singleton<GsonConverterFactory> gsonFactory = new Singleton<GsonConverterFactory>() {
@Override
public GsonConverterFactory create() {
return GsonConverterFactory.create(JsonUtil.getGson());
}
};
private static final Singleton<w> retrofit = new Singleton<w>() {
@Override
public w create() {
w.a aVar = new w.a();
aVar.a(ZOkHttpFactory.getClient());
aVar.a((e.a) ZRetrofit.gsonFactory.get());
aVar.a(HttpUrl.parse("https://zhizhangyi.com/"));
return aVar.a();
}
};
private static final Singleton<w> retrofitDirect = new Singleton<w>() {
@Override
public w create() {
w.a c2 = ((w) ZRetrofit.retrofit.get()).c();
c2.a(new Executor() {
@Override
public void execute(Runnable runnable) {
runnable.run();
}
});
return c2.a();
}
};
public static GsonConverterFactory getGsonFactory() {
return gsonFactory.get();
}
public static w getRetrofit() {
return retrofitDirect.get();
}
public static <T> TypeAdapter<T> getTypeAdapter(Class<T> cls) {
return (TypeAdapter<T>) gsonFactory.get().getTypeAdapter(cls);
}
public static w getUIRetrofit() {
return retrofit.get();
}
}