use of com.google.api.server.spi.types.DateAndTime in project endpoints-java by cloudendpoints.
the class ServletResponseResultWriter method getWriteDateAndTimeAsStringModule.
private static SimpleModule getWriteDateAndTimeAsStringModule() {
JsonSerializer<DateAndTime> dateAndTimeSerializer = new JsonSerializer<DateAndTime>() {
@Override
public void serialize(DateAndTime value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
jgen.writeString(value.toRfc3339String());
}
};
SimpleModule writeDateAsStringModule = new SimpleModule("writeDateAsStringModule", new Version(1, 0, 0, null, null, null));
writeDateAsStringModule.addSerializer(DateAndTime.class, dateAndTimeSerializer);
return writeDateAsStringModule;
}
Aggregations