aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-11-06 19:39:11 -0500
committerJames Moger <james.moger@gitblit.com>2014-11-06 23:10:42 -0500
commit9817bb2b4712e20e88f8a7803dec41d66263eb81 (patch)
treef15349c46c7bf86319217ffbe6d8043e3dd451e0 /src/main/java
parent09a2c37d83a2eff6bc65cdc69e8fe2869fe9709c (diff)
downloadiciql-9817bb2b4712e20e88f8a7803dec41d66263eb81.tar.gz
iciql-9817bb2b4712e20e88f8a7803dec41d66263eb81.zip
Improve Date type conversions
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/iciql/util/Utils.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/com/iciql/util/Utils.java b/src/main/java/com/iciql/util/Utils.java
index e542054..346c6d7 100644
--- a/src/main/java/com/iciql/util/Utils.java
+++ b/src/main/java/com/iciql/util/Utils.java
@@ -31,6 +31,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.IdentityHashMap;
@@ -320,6 +321,19 @@ public class Utils {
}
}
+ if (Date.class.isAssignableFrom(currentType)) {
+ Date d = (Date) o;
+ if (targetType == Date.class) {
+ return o;
+ } else if (targetType == java.sql.Date.class) {
+ return new java.sql.Date(d.getTime());
+ } else if (targetType == java.sql.Time.class) {
+ return new java.sql.Time(d.getTime());
+ } else if (targetType == java.sql.Timestamp.class) {
+ return new java.sql.Timestamp(d.getTime());
+ }
+ }
+
// convert from BLOB
if (targetType == byte[].class) {
if (Blob.class.isAssignableFrom(currentType)) {