summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorJames Moger <james.moger@gmail.com>2011-08-08 09:32:30 -0400
committerJames Moger <james.moger@gmail.com>2011-08-08 09:32:30 -0400
commit083e5031c24efd8cdb08140b9f982604a431ec26 (patch)
tree07b3d1b16eee3122f7c8792839a4ce493a2615ad /src/com
parent1ee319a7e4bea883da99ab7c2068a740e2cdf985 (diff)
downloadiciql-083e5031c24efd8cdb08140b9f982604a431ec26.tar.gz
iciql-083e5031c24efd8cdb08140b9f982604a431ec26.zip
Fully support H2 UUID type. Cleanup imports for generated models.
Diffstat (limited to 'src/com')
-rw-r--r--src/com/iciql/ModelUtils.java2
-rw-r--r--src/com/iciql/TableInspector.java7
-rw-r--r--src/com/iciql/util/Utils.java3
3 files changed, 10 insertions, 2 deletions
diff --git a/src/com/iciql/ModelUtils.java b/src/com/iciql/ModelUtils.java
index 4f53d3b..51c2d6c 100644
--- a/src/com/iciql/ModelUtils.java
+++ b/src/com/iciql/ModelUtils.java
@@ -25,6 +25,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.UUID;
import java.util.regex.Pattern;
import com.iciql.TableDefinition.FieldDefinition;
@@ -58,6 +59,7 @@ class ModelUtils {
m.put(java.sql.Date.class, "DATE");
m.put(java.sql.Time.class, "TIME");
m.put(byte[].class, "BLOB");
+ m.put(UUID.class, "UUID");
// map primitives
m.put(boolean.class, m.get(Boolean.class));
diff --git a/src/com/iciql/TableInspector.java b/src/com/iciql/TableInspector.java
index a4b3b8f..080e20e 100644
--- a/src/com/iciql/TableInspector.java
+++ b/src/com/iciql/TableInspector.java
@@ -326,8 +326,11 @@ public class TableInspector {
sb.append("// unsupported type " + col.type);
} else {
// Imports
- // don't import byte []
- if (!clazz.equals(byte[].class)) {
+ // don't import primitives, java.lang classes, or byte []
+ if (clazz.getPackage() == null) {
+ } else if (clazz.getPackage().getName().equals("java.lang")) {
+ } else if (clazz.equals(byte[].class)) {
+ } else {
imports.add(clazz.getCanonicalName());
}
// @IQColumn
diff --git a/src/com/iciql/util/Utils.java b/src/com/iciql/util/Utils.java
index d99f33b..3846c32 100644
--- a/src/com/iciql/util/Utils.java
+++ b/src/com/iciql/util/Utils.java
@@ -35,6 +35,7 @@ import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
+import java.util.UUID;
import java.util.concurrent.atomic.AtomicLong;
import com.iciql.Iciql.EnumId;
@@ -159,6 +160,8 @@ public class Utils {
// enums can not be instantiated reflectively
// return first constant as reference
return clazz.getEnumConstants()[0];
+ } else if (clazz == java.util.UUID.class) {
+ return (T) UUID.randomUUID();
} else if (clazz == List.class) {
return (T) new ArrayList();
}