summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/amazon/carbonado/adapter/DateTimeAdapter.java48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/main/java/com/amazon/carbonado/adapter/DateTimeAdapter.java b/src/main/java/com/amazon/carbonado/adapter/DateTimeAdapter.java
index c1119ac..fc12319 100644
--- a/src/main/java/com/amazon/carbonado/adapter/DateTimeAdapter.java
+++ b/src/main/java/com/amazon/carbonado/adapter/DateTimeAdapter.java
@@ -174,6 +174,18 @@ public @interface DateTimeAdapter {
return date == null ? null : new DateTime(date, mZone);
}
+ public DateTime adaptToDateTime(java.sql.Date date) {
+ return date == null ? null : new DateTime(date.getTime(), mZone);
+ }
+
+ public DateTime adaptToDateTime(Time time) {
+ return time == null ? null : new DateTime(time.getTime(), mZone);
+ }
+
+ public DateTime adaptToDateTime(Timestamp timestamp) {
+ return timestamp == null ? null : new DateTime(timestamp.getTime(), mZone);
+ }
+
// Adapt to DateMidnight...
public DateMidnight adaptToDateMidnight(long instant) {
@@ -192,6 +204,18 @@ public @interface DateTimeAdapter {
return date == null ? null : new DateMidnight(date, mZone);
}
+ public DateMidnight adaptToDateMidnight(java.sql.Date date) {
+ return date == null ? null : new DateMidnight(date.getTime(), mZone);
+ }
+
+ public DateMidnight adaptToDateMidnight(Time time) {
+ return time == null ? null : new DateMidnight(time.getTime(), mZone);
+ }
+
+ public DateMidnight adaptToDateMidnight(Timestamp timestamp) {
+ return timestamp == null ? null : new DateMidnight(timestamp.getTime(), mZone);
+ }
+
// Adapt to LocalDateTime...
public LocalDateTime adaptToLocalDateTime(long instant) {
@@ -210,6 +234,18 @@ public @interface DateTimeAdapter {
return date == null ? null : new LocalDateTime(date, mZone);
}
+ public LocalDateTime adaptToLocalDateTime(java.sql.Date date) {
+ return date == null ? null : new LocalDateTime(date.getTime(), mZone);
+ }
+
+ public LocalDateTime adaptToLocalDateTime(Time time) {
+ return time == null ? null : new LocalDateTime(time.getTime(), mZone);
+ }
+
+ public LocalDateTime adaptToLocalDateTime(Timestamp timestamp) {
+ return timestamp == null ? null : new LocalDateTime(timestamp.getTime(), mZone);
+ }
+
// Adapt to LocalDate...
public LocalDate adaptToLocalDate(long instant) {
@@ -228,6 +264,18 @@ public @interface DateTimeAdapter {
return date == null ? null : new LocalDate(date, mZone);
}
+ public LocalDate adaptToLocalDate(java.sql.Date date) {
+ return date == null ? null : new LocalDate(date.getTime(), mZone);
+ }
+
+ public LocalDate adaptToLocalDate(Time time) {
+ return time == null ? null : new LocalDate(time.getTime(), mZone);
+ }
+
+ public LocalDate adaptToLocalDate(Timestamp timestamp) {
+ return timestamp == null ? null : new LocalDate(timestamp.getTime(), mZone);
+ }
+
// Adapt from DateTime and DateMidnight... (accept the more generic ReadableInstant)
public long adaptToLong(ReadableInstant instant) {