INNER CODE UNIT · Java
read
gruelbox/transaction-outbox · transactionoutbox-core/src/main/java/com/gruelbox/transactionoutbox/DefaultInvocationSerializer.java:376
public Duration read(JsonReader in) throws IOException {
return Duration.of(in.nextLong(), ChronoUnit.SECONDS);
}
}
static final class LocalDateTypeAdapter extends TypeAdapter<LocalDate> {
@Override
public void write(JsonWriter out, LocalDate value) throws IOException {
out.value(DateTimeFormatter.ISO_LOCAL_DATE.format(value));
}
@Override
public LocalDate read(JsonReader in) throws IOException {
return DateTimeFormatter.ISO_LOCAL_DATE.parse(in.nextString(), LocalDate::from);
}
}