com.fatboyindustrial.gsonjavatime.Converters Java Examples

The following examples show how to use com.fatboyindustrial.gsonjavatime.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 Project: OpenIoE   Author: scorelab   File: MqttConsumerThread.java    License: Apache License 2.0 5 votes vote down vote up
public MqttConsumerThread(SensorRepository sensorRepository, SensorDataRepositoryService databaseService, IoeConfiguration ioeConfiguration, SubscriptionRepository subscriptionRepository) {
    this.ioeConfiguration = ioeConfiguration;
    this.subscriptionRepository = subscriptionRepository;
    this.sensorRepository = sensorRepository;
    this.databaseService = databaseService;
    gson = Converters.registerAll(new GsonBuilder()).create();
}
 
Example #2
Source Project: molgenis   Author: molgenis   File: GsonFactoryBean.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void afterPropertiesSet() {
  GsonBuilder builder = new GsonBuilder();
  if (this.serializeNulls) {
    builder.serializeNulls();
  }
  if (this.prettyPrinting) {
    builder.setPrettyPrinting();
  }
  if (this.disableHtmlEscaping) {
    builder.disableHtmlEscaping();
  }
  if (this.dateFormatPattern != null) {
    builder.setDateFormat(this.dateFormatPattern);
  }
  if (this.typeAdapterFactoryList != null) {
    typeAdapterFactoryList.forEach(builder::registerTypeAdapterFactory);
  }
  if (this.typeAdapterHierarchyFactoryMap != null) {
    typeAdapterHierarchyFactoryMap.forEach(builder::registerTypeHierarchyAdapter);
  }
  if (this.registerJavaTimeConverters) {
    Converters.registerInstant(builder);
    Converters.registerLocalDate(builder);
  }
  this.gson = builder.create();
}
 
Example #3
Source Project: OpenIoE   Author: scorelab   File: BrokerMessageListener.java    License: Apache License 2.0 4 votes vote down vote up
public BrokerMessageListener(SensorRepository sensorRepository, SensorDataRepositoryService databaseService) {
    this.sensorRepository = sensorRepository;
    this.databaseService = databaseService;
    gson = Converters.registerAll(new GsonBuilder()).create();
}