Java Code Examples for retrofit2.converter.gson.GsonConverterFactory#create()
The following examples show how to use
retrofit2.converter.gson.GsonConverterFactory#create() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NetworkAPITest.java From Mysplash with GNU Lesser General Public License v3.0 | 5 votes |
@BeforeClass public static void init() { Scheduler immediate = new Scheduler() { @Override public Disposable scheduleDirect(@NonNull Runnable run, long delay, @NonNull TimeUnit unit) { return super.scheduleDirect(run, 0, unit); } @Override public Worker createWorker() { return new ExecutorScheduler.ExecutorWorker(Runnable::run, false); } }; RxJavaPlugins.setInitIoSchedulerHandler(scheduler -> immediate); RxJavaPlugins.setInitComputationSchedulerHandler(scheduler -> immediate); RxJavaPlugins.setInitNewThreadSchedulerHandler(scheduler -> immediate); RxJavaPlugins.setInitSingleSchedulerHandler(scheduler -> immediate); RxAndroidPlugins.setInitMainThreadSchedulerHandler(scheduler -> immediate); OkHttpClient httpClient = TLSCompactHelper.getOKHttpClient(); GsonConverterFactory gsonConverterFactory = GsonConverterFactory.create(); RxJava2CallAdapterFactory rxJava2CallAdapterFactory = RxJava2CallAdapterFactory.create(); CompositeDisposable disposable = new CompositeDisposable(); photoService = new PhotoService( httpClient, gsonConverterFactory, rxJava2CallAdapterFactory, disposable ); }
Example 2
Source File: HttpHelper.java From LockDemo with Apache License 2.0 | 5 votes |
private HttpHelper() { mGsonConverterFactory = GsonConverterFactory.create(); mAdapterFactory = RxJava2CallAdapterFactory.create(); //设置超时时间 mOkHttpClient = new HttpCustomConfig().build(); }
Example 3
Source File: BaseNet.java From AFBaseLibrary with Apache License 2.0 | 5 votes |
/** * 默认使用Gson转换器,可以根据后台情况约定返回类型,并自定义转换器 */ protected Converter.Factory getDefaultConvertFactory() { if (converterFactory == null) { converterFactory = GsonConverterFactory.create(); } return converterFactory; }
Example 4
Source File: ApiModule.java From AndroidBlueprints with Apache License 2.0 | 5 votes |
@Provides @Singleton GsonConverterFactory provideGsonConverter() { return GsonConverterFactory.create( new GsonBuilder() .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES) .create()); }
Example 5
Source File: ApiModule.java From AndroidBlueprints with Apache License 2.0 | 5 votes |
@Provides @Singleton GsonConverterFactory provideGsonConverter() { return GsonConverterFactory.create( new GsonBuilder() .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES) .create()); }
Example 6
Source File: ApiModule.java From AndroidBlueprints with Apache License 2.0 | 5 votes |
@Provides @Singleton GsonConverterFactory provideGsonConverter() { return GsonConverterFactory.create( new GsonBuilder() .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES) .create()); }
Example 7
Source File: ApiModule.java From fyber_mobile_offers with MIT License | 4 votes |
@Provides @Singleton public Converter.Factory provideGsonConverterFactory(Gson gson) { return GsonConverterFactory.create(gson); }
Example 8
Source File: ApiClient.java From openapi-generator with Apache License 2.0 | 4 votes |
private GsonCustomConverterFactory(Gson gson) { if (gson == null) throw new NullPointerException("gson == null"); this.gson = gson; this.gsonConverterFactory = GsonConverterFactory.create(gson); }
Example 9
Source File: RestModule.java From octoandroid with GNU General Public License v3.0 | 4 votes |
@Provides @Singleton GsonConverterFactory provideGsonConverterFactory(Gson gson) { return GsonConverterFactory.create(gson); }
Example 10
Source File: ApiServiceModule.java From MVP-Dagger2-Rxjava-Retrofit with Apache License 2.0 | 4 votes |
@Provides @Singleton protected GsonConverterFactory provideGsonConverterFactory() { return GsonConverterFactory.create(); }
Example 11
Source File: OkApiModule.java From Forage with Mozilla Public License 2.0 | 4 votes |
@NonNull @Provides @Singleton public static GsonConverterFactory provideGsonConverterFactory(@NonNull Gson gson) { return GsonConverterFactory.create(gson); }
Example 12
Source File: RetrofitModule.java From Moxy with MIT License | 4 votes |
@Provides @Singleton public Converter.Factory provideConverterFactory(Gson gson) { return GsonConverterFactory.create(gson); }
Example 13
Source File: ApiModule.java From marvel with MIT License | 4 votes |
@Provides @Singleton public Converter.Factory provideGsonConverterFactory(Gson gson) { return GsonConverterFactory.create(gson); }
Example 14
Source File: NetworkModule.java From Mysplash with GNU Lesser General Public License v3.0 | 4 votes |
@Provides public GsonConverterFactory getGsonConverterFactory() { return GsonConverterFactory.create(); }
Example 15
Source File: ApiServiceModule.java From mvp-android-arch-component with MIT License | 4 votes |
@Provides @Singleton Converter.Factory provideGsonConverterFactory() { return GsonConverterFactory.create(); }
Example 16
Source File: BaseService.java From nongbeer-mvp-android-demo with Apache License 2.0 | 4 votes |
private Converter.Factory addConverter(){ return GsonConverterFactory.create( new GsonBuilder().setPrettyPrinting().create() ); }
Example 17
Source File: ApiClient.java From android with MIT License | 4 votes |
private GsonCustomConverterFactory(Gson gson) { if (gson == null) throw new NullPointerException("gson == null"); this.gson = gson; this.gsonConverterFactory = GsonConverterFactory.create(gson); }
Example 18
Source File: FtsRetrofitModule.java From fingen with Apache License 2.0 | 4 votes |
@Provides @Singleton public Converter.Factory provideConverterFactory(Gson gson) { return GsonConverterFactory.create(gson); }
Example 19
Source File: ApiClient.java From openapi-generator with Apache License 2.0 | 4 votes |
private GsonCustomConverterFactory(Gson gson) { if (gson == null) throw new NullPointerException("gson == null"); this.gson = gson; this.gsonConverterFactory = GsonConverterFactory.create(gson); }
Example 20
Source File: ApiClient.java From openapi-generator with Apache License 2.0 | 4 votes |
private GsonCustomConverterFactory(Gson gson) { if (gson == null) throw new NullPointerException("gson == null"); this.gson = gson; this.gsonConverterFactory = GsonConverterFactory.create(gson); }