summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2007-09-05 00:07:58 +0000
committerBrian S. O'Neill <bronee@gmail.com>2007-09-05 00:07:58 +0000
commita602f34ec4b845a442b1152e02d655c4cd200acf (patch)
treea71a19df4d3ea97422da3adf5d20ba8d829d0230 /src
parentce4fecd9d313d61d9468954c675e735d468a4a5e (diff)
More fixes for adapting SQL dates.
Diffstat (limited to 'src')
-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) {