You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of release 0.9.1 Redis OM for Spring (Java) supports JSON serialization/deserialization for both the java.time.LocalDate and java.time.LocalDateTime types. Would it be possible to add support for java.time.YearMonth? I have written my own TypeAdapter (see below), but for others it would be a time saver. Thanks for your time :)
public final class YearMonthGsonTypeAdapter extends TypeAdapter {
private final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
@Override
public void write(JsonWriter writer, YearMonth yearMonth) throws IOException {
if (yearMonth == null) {
writer.nullValue();
return;
}
writer.value(yearMonth.format(formatter));
}
@Override
public YearMonth read(JsonReader reader) throws IOException {
if (reader.peek() == JsonToken.NULL) {
reader.nextNull();
return null;
}
final String yearMonthStr = reader.nextString();
return YearMonth.parse(yearMonthStr, formatter);
}
}
The text was updated successfully, but these errors were encountered:
Good Afternoon,
As of release 0.9.1 Redis OM for Spring (Java) supports JSON serialization/deserialization for both the java.time.LocalDate and java.time.LocalDateTime types. Would it be possible to add support for java.time.YearMonth? I have written my own TypeAdapter (see below), but for others it would be a time saver. Thanks for your time :)
public final class YearMonthGsonTypeAdapter extends TypeAdapter {
}
The text was updated successfully, but these errors were encountered: