レトロフィット用のインターフェースを書きましたが、
public interface MyService {
@POST("/api/index")
<T> Observable<T> doRequest(@Body Object request);
}
次に、サービスを構築し、
RestAdapter restAdapter = new RestAdapter.Builder()
.setEndpoint("http://localtest.com")
.setConverter(new FastJsonConverter())
.setRequestInterceptor(new CookiesInterceptor(LApplication.getInstance()))
.build();
this.service = restAdapter.create(MyService.class);
私が要求するとき:
Observable<Response> resp = service.doRequest(getRequest())
resp.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(maoApi.mSubscriber);
しかし、コンバーターはjsonをレスポンスオブジェクトに変換できませんか?
タイプType in FastJsonConverter:fromBody(TypedInput body, Type type)
はT
です。
また、 Gson を使用すると、まだこの問題があります...
この問題を解決するには?それとも私のデザインが間違っていますか?