Refactor ScalarTypeBaseDateTime, merge into ScalarTypeUtils both IsoJsonDateTimeParser and DecimalUtils

That is, merge the static util methods into ScalarTypeUtils
This commit is contained in:
Rob Bygrave committed 2022-08-26 13:15:55 +12:00
1 parent f319ee66ad
commit a13f581a65
16 files changed
+69 -74

No files matched your search

@@ -12,7 +12,7 @@ import java.sql.Types;
import java.time.Instant;
import java.util.Calendar;
import static io.ebean.core.type.IsoJsonDateTimeParser.formatIso;
import static io.ebean.core.type.ScalarTypeUtils.formatInstant;
/**
* ScalarType for java.util.Calendar.
@@ -66,7 +66,7 @@ final class ScalarTypeCalendar extends ScalarTypeBaseDateTime<Calendar> {
@Override
protected String toJsonISO8601(Calendar value) {
return formatIso(value.toInstant());
return formatInstant(value.toInstant());
}
@Override
@@ -27,11 +27,11 @@ class ScalarTypeDuration extends ScalarTypeBase<Duration> {
}
BigDecimal convertToBigDecimal(Duration value) {
return (value == null) ? null : DecimalUtils.toDecimal(value);
return (value == null) ? null : ScalarTypeUtils.toDecimal(value);
}
Duration convertFromBigDecimal(BigDecimal value) {
return (value == null) ? null : DecimalUtils.toDuration(value);
return (value == null) ? null : ScalarTypeUtils.toDuration(value);
}
@Override
@@ -9,7 +9,7 @@ import java.time.Instant;
import java.time.OffsetDateTime;
import java.time.ZoneId;
import static io.ebean.core.type.IsoJsonDateTimeParser.formatIso;
import static io.ebean.core.type.ScalarTypeUtils.formatInstant;
/**
* ScalarType for java.sql.Timestamp.
@@ -30,7 +30,7 @@ final class ScalarTypeOffsetDateTime extends ScalarTypeBaseDateTime<OffsetDateTi
@Override
protected String toJsonISO8601(OffsetDateTime value) {
return formatIso(value.toInstant());
return formatInstant(value.toInstant());
}
@Override
@@ -11,7 +11,7 @@ import java.sql.Timestamp;
import java.sql.Types;
import java.time.Instant;
import static io.ebean.core.type.IsoJsonDateTimeParser.formatIso;
import static io.ebean.core.type.ScalarTypeUtils.formatInstant;
/**
* ScalarType for java.sql.Timestamp.
@@ -29,7 +29,7 @@ final class ScalarTypeTimestamp extends ScalarTypeBaseDateTime<Timestamp> {
@Override
protected String toJsonISO8601(Timestamp value) {
return formatIso(value.toInstant());
return formatInstant(value.toInstant());
}
@Override
@@ -13,7 +13,7 @@ import java.sql.Types;
import java.time.Instant;
import java.util.Date;
import static io.ebean.core.type.IsoJsonDateTimeParser.formatIso;
import static io.ebean.core.type.ScalarTypeUtils.formatInstant;
/**
* ScalarType for java.util.Date.
@@ -33,7 +33,7 @@ final class ScalarTypeUtilDate {
@Override
protected String toJsonISO8601(Date value) {
return formatIso(value.toInstant());
return formatInstant(value.toInstant());
}
@Override