add scalar converter to retrofit2

Fix #2177
This commit is contained in:
cbornet
2016-03-07 09:19:55 +00:00
parent b84694380b
commit 6f114a1556
22 changed files with 649 additions and 20 deletions

View File

@@ -12,8 +12,9 @@ import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuil
import retrofit2.Converter;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
{{#useRxJava}}import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;{{/useRxJava}}
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.converter.scalars.ScalarsConverterFactory;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -120,6 +121,7 @@ public class ApiClient {
.baseUrl(baseUrl)
.client(okClient)
{{#useRxJava}}.addCallAdapterFactory(RxJavaCallAdapterFactory.create()){{/useRxJava}}
.addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(GsonCustomConverterFactory.create(gson));
}

View File

@@ -103,6 +103,7 @@ ext {
dependencies {
compile "com.squareup.retrofit2:retrofit:$retrofit_version"
compile "com.squareup.retrofit2:converter-scalars:$retrofit_version"
compile "com.squareup.retrofit2:converter-gson:$retrofit_version"
{{#useRxJava}}
compile "com.squareup.retrofit2:adapter-rxjava:$retrofit_version"

View File

@@ -118,6 +118,11 @@
<artifactId>retrofit</artifactId>
<version>${retrofit-version}</version>
</dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>converter-scalars</artifactId>
<version>${retrofit-version}</version>
</dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>converter-gson</artifactId>