com.fatboyindustrial.gsonjodatime.Converters Java Examples

The following examples show how to use com.fatboyindustrial.gsonjodatime.Converters. 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: WebConfig.java    From WebIDE-Backend with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private Gson gson() {
    final GsonBuilder builder = new GsonBuilder();
    // support swagger json
    builder.registerTypeAdapter(Json.class, new SpringfoxJsonToGsonAdapter());

    return Converters.registerDateTime(builder).create();
}
 
Example #2
Source File: WebSocketConfig.java    From WebIDE-Backend with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public boolean configureMessageConverters(List<MessageConverter> messageConverters) {
    messageConverters.add(new StringMessageConverter());
    messageConverters.add(new ByteArrayMessageConverter());

    GsonMessageConverter gsonMessageConverter = new GsonMessageConverter();
    gsonMessageConverter.setGson(Converters.registerDateTime(new GsonBuilder()).create());
    messageConverters.add(gsonMessageConverter);

    return false;
}
 
Example #3
Source File: GsonModule.java    From android-rxmvp-tutorial with Apache License 2.0 5 votes vote down vote up
@AppScope
@Provides
public Gson context() {
  return Converters.registerAll(new GsonBuilder())
      .registerTypeAdapterFactory(GithubAdapterFactory.create())
      .create();
}
 
Example #4
Source File: GsonModule.java    From android-rxmvp with Apache License 2.0 5 votes vote down vote up
@AppScope
@Provides
public Gson gson() {
    GsonBuilder builder = new GsonBuilder();
    Converters.registerAll(builder);
    return builder.create();
}