-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
The default JsonSupport comes with GsonSupport class with predefined configuration:
private static class GsonCompressedHolder {
private static final Gson INSTANCE = new GsonBuilder()
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
.registerTypeAdapter(OFFSET_DATE_TIME_TYPE, new OffsetDateTimeSerdes())
.setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX")
.create();
}
private static class GsonHolder {
private static final Gson INSTANCE = new GsonBuilder()
.setPrettyPrinting()
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
.registerTypeAdapter(OFFSET_DATE_TIME_TYPE, new OffsetDateTimeSerdes())
.setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX")
.create();
}It's pretty common case that we need to specify another parameters for Gson INSTANCE - for example, field naming policy. The decision for now is to define our own JsonSupport implementation and specify Gson as we need it. But it seems to me that it can be more easy to support this feature in nakadi-java: provide your own Gson object or parameters to create Gson objectn during creation of NakadiClient.
Metadata
Metadata
Assignees
Labels
No labels