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 File: MqttConsumerThread.java    From OpenIoE with 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 File: GsonFactoryBean.java    From molgenis with 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 File: BrokerMessageListener.java    From OpenIoE with 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();
}