Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wd1105040417
retrofit
提交
aa7a7954
R
retrofit
项目概览
wd1105040417
/
retrofit
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
retrofit
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
aa7a7954
编写于
4月 03, 2016
作者:
J
Jake Wharton
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adapter Javadoc details.
上级
b50cf58e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
56 addition
and
0 deletion
+56
-0
retrofit-adapters/guava/src/main/java/retrofit2/adapter/guava/GuavaCallAdapterFactory.java
...java/retrofit2/adapter/guava/GuavaCallAdapterFactory.java
+22
-0
retrofit-adapters/java8/src/main/java/retrofit2/adapter/java8/Java8CallAdapterFactory.java
...java/retrofit2/adapter/java8/Java8CallAdapterFactory.java
+22
-0
retrofit-adapters/rxjava/src/main/java/retrofit2/adapter/rxjava/RxJavaCallAdapterFactory.java
...va/retrofit2/adapter/rxjava/RxJavaCallAdapterFactory.java
+12
-0
未找到文件。
retrofit-adapters/guava/src/main/java/retrofit2/adapter/guava/GuavaCallAdapterFactory.java
浏览文件 @
aa7a7954
...
...
@@ -17,6 +17,7 @@ package retrofit2.adapter.guava;
import
com.google.common.util.concurrent.AbstractFuture
;
import
com.google.common.util.concurrent.ListenableFuture
;
import
java.io.IOException
;
import
java.lang.annotation.Annotation
;
import
java.lang.reflect.ParameterizedType
;
import
java.lang.reflect.Type
;
...
...
@@ -26,6 +27,27 @@ import retrofit2.Callback;
import
retrofit2.Response
;
import
retrofit2.Retrofit
;
/**
* A {@linkplain CallAdapter.Factory call adapter} which creates Guava futures.
* <p>
* Adding this class to {@link Retrofit} allows you to return {@link ListenableFuture} from service
* methods.
* <pre>{@code
* interface MyService {
* @GET("user/me")
* ListenableFuture<User> getUser()
* }
* }</pre>
* There are two configurations supported for the {@code ListenableFuture} type parameter:
* <ul>
* <li>Direct body (e.g., {@code ListenableFuture<User>}) returns the deserialized body for 2XX
* responses, sets {@link HttpException} errors for non-2XX responses, and sets {@link IOException}
* for network errors.</li>
* <li>Response wrapped body (e.g., {@code ListenableFuture<Response<User>>}) returns a
* {@link Response} object for all HTTP responses and sets {@link IOException} for network
* errors</li>
* </ul>
*/
public
final
class
GuavaCallAdapterFactory
extends
CallAdapter
.
Factory
{
public
static
GuavaCallAdapterFactory
create
()
{
return
new
GuavaCallAdapterFactory
();
...
...
retrofit-adapters/java8/src/main/java/retrofit2/adapter/java8/Java8CallAdapterFactory.java
浏览文件 @
aa7a7954
...
...
@@ -15,6 +15,7 @@
*/
package
retrofit2.adapter.java8
;
import
java.io.IOException
;
import
java.lang.annotation.Annotation
;
import
java.lang.reflect.ParameterizedType
;
import
java.lang.reflect.Type
;
...
...
@@ -25,6 +26,27 @@ import retrofit2.Callback;
import
retrofit2.Response
;
import
retrofit2.Retrofit
;
/**
* A {@linkplain CallAdapter.Factory call adapter} which creates Java 8 futures.
* <p>
* Adding this class to {@link Retrofit} allows you to return {@link CompletableFuture} from
* service methods.
* <pre>{@code
* interface MyService {
* @GET("user/me")
* CompletableFuture<User> getUser()
* }
* }</pre>
* There are two configurations supported for the {@code CompletableFuture} type parameter:
* <ul>
* <li>Direct body (e.g., {@code CompletableFuture<User>}) returns the deserialized body for 2XX
* responses, sets {@link HttpException} errors for non-2XX responses, and sets {@link IOException}
* for network errors.</li>
* <li>Response wrapped body (e.g., {@code CompletableFuture<Response<User>>}) returns a
* {@link Response} object for all HTTP responses and sets {@link IOException} for network
* errors</li>
* </ul>
*/
public
final
class
Java8CallAdapterFactory
extends
CallAdapter
.
Factory
{
public
static
Java8CallAdapterFactory
create
()
{
return
new
Java8CallAdapterFactory
();
...
...
retrofit-adapters/rxjava/src/main/java/retrofit2/adapter/rxjava/RxJavaCallAdapterFactory.java
浏览文件 @
aa7a7954
...
...
@@ -15,6 +15,7 @@
*/
package
retrofit2.adapter.rxjava
;
import
java.io.IOException
;
import
java.lang.annotation.Annotation
;
import
java.lang.reflect.ParameterizedType
;
import
java.lang.reflect.Type
;
...
...
@@ -43,6 +44,17 @@ import rx.subscriptions.Subscriptions;
* Observable<User> getUser()
* }
* }</pre>
* There are three configurations supported for the {@code Observable} type parameter:
* <ul>
* <li>Direct body (e.g., {@code Observable<User>}) calls {@code onNext} with the deserialized body
* for 2XX responses and calls {@code onError} with {@link HttpException} for non-2XX responses and
* {@link IOException} for network errors.</li>
* <li>Response wrapped body (e.g., {@code Observable<Response<User>>}) calls {@code onNext}
* with a {@link Response} object for all HTTP responses and calls {@code onError} with
* {@link IOException} for network errors</li>
* <li>Result wrapped body (e.g., {@code Observable<Result<User>>}) calls {@code onNext} with a
* {@link Result} object for all HTTP responses and errors.</li>
* </ul>
*/
public
final
class
RxJavaCallAdapterFactory
extends
CallAdapter
.
Factory
{
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录