Retrofit
2016-07-14 17:59:07 0 举报
Retrofit是一个类型安全的HTTP客户端,由Square公司开发。它主要用于Android和Java应用,可以将HTTP API转换为Java接口。Retrofit的主要优点是它可以将复杂的HTTP请求转换为简洁的Java方法调用,使得开发者可以更专注于业务逻辑,而不是底层的网络通信细节。此外,Retrofit还支持RxJava,使得异步编程更加简单和优雅。Retrofit的设计哲学是“少即是多”,它只提供必要的功能,但每个功能都被精心设计和实现,以满足开发者的需求。总的来说,Retrofit是一个强大而灵活的HTTP客户端库,可以帮助开发者更容易地构建和维护网络应用。
作者其他创作
大纲/内容
okhttp3.Call.Factory
Call newCall(Request request);
ExecutorCallAdapterFactory.ExecutorCallbackCall
OkHttpCall(网络请求类)
private final ServiceMethod serviceMethod;private final Object[] args;private volatile boolean canceled;private okhttp3.Call rawCall;private Throwable creationFailure; private boolean executed;
public synchronized Request request();public void enqueue(final Callback callback) ;
实现类
retrofit2.CallAdapter
Type responseType(); T adapt(Call call);
retrofit2.Call
Response execute() throws IOException;void enqueue(Callback callback);boolean isExecuted();void cancel();boolean isCanceled();Request request();Call clone();
ExecutorCallAdapterFactory
Executor callbackExecutor;
CallAdapter.Factory
okhttp3.Call
Request request();Response execute() throws IOException;void enqueue(Callback responseCallback);void cancel();boolean isExecuted();boolean isCanceled();
Executor
void execute(Runnable var1);
Platform.Android.MainThreadExecutor
private final Handler handler = new Handler(Looper.getMainLooper());
public void execute(Runnable r) { handler.post(r); }
0 条评论
下一页