List of usage examples for com.google.gson GsonBuilder setExclusionStrategies
public GsonBuilder setExclusionStrategies(ExclusionStrategy... strategies)
From source file:pl.datamatica.traccar.api.Context.java
License:Open Source License
private Context() { emf = Persistence.createEntityManagerFactory("release"); Map<String, String> properties = getApiConnectionData(); if (properties.size() > 0) { // Use properties obtained from 'debug.xml' or PRODUCTION_TRACCAR_CONFIG_FILE if possible emfMetadata = Persistence.createEntityManagerFactory("traccar_api_metadata_persistence", properties); } else {/* w w w.j a v a 2 s . c o m*/ // Otherwise settings from 'persistence.xml' will be used emfMetadata = Persistence.createEntityManagerFactory("traccar_api_metadata_persistence"); } GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.setDateFormat(Application.DATE_FORMAT); gsonBuilder.setExclusionStrategies(new AnnotationExclusionStrategy()); if (isInDevMode()) gsonBuilder.setPrettyPrinting(); gson = gsonBuilder.create(); daemonExecutor = Executors.newScheduledThreadPool(2); }