aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Moger <james.moger@gmail.com>2011-08-05 17:15:45 -0400
committerJames Moger <james.moger@gmail.com>2011-08-05 17:15:45 -0400
commit0c5463e7372fe4c47341dcf0c48bdd94682d0c7c (patch)
tree402aa2ea095bd79a83205c2474da6e4ac753fcb8 /src
parent2b180c643562e5f789b638f16f90607d2473590c (diff)
downloadiciql-0c5463e7372fe4c47341dcf0c48bdd94682d0c7c.tar.gz
iciql-0c5463e7372fe4c47341dcf0c48bdd94682d0c7c.zip
IndexValidation was broken for single-indexes or non-standard indexes.v0.6.2
Diffstat (limited to 'src')
-rw-r--r--src/com/iciql/Constants.java2
-rw-r--r--src/com/iciql/TableInspector.java18
2 files changed, 15 insertions, 5 deletions
diff --git a/src/com/iciql/Constants.java b/src/com/iciql/Constants.java
index 63bfeff..d78f1db 100644
--- a/src/com/iciql/Constants.java
+++ b/src/com/iciql/Constants.java
@@ -25,7 +25,7 @@ public class Constants {
// The build script extracts this exact line so be careful editing it
// and only use A-Z a-z 0-9 .-_ in the string.
- public static final String VERSION = "0.6.1";
+ public static final String VERSION = "0.6.2";
// The build script extracts this exact line so be careful editing it
// and only use A-Z a-z 0-9 .-_ in the string.
diff --git a/src/com/iciql/TableInspector.java b/src/com/iciql/TableInspector.java
index 82b732a..a4b3b8f 100644
--- a/src/com/iciql/TableInspector.java
+++ b/src/com/iciql/TableInspector.java
@@ -180,7 +180,7 @@ public class TableInspector {
imports.add(IQTable.class.getCanonicalName());
imports.add(IQIndexes.class.getCanonicalName());
imports.add(IQIndex.class.getCanonicalName());
- imports.add(IQColumn.class.getCanonicalName());
+ imports.add(IQColumn.class.getCanonicalName());
imports.add(IndexType.class.getCanonicalName());
// fields
@@ -276,7 +276,8 @@ public class TableInspector {
AnnotationBuilder ap = new AnnotationBuilder();
if (indexes.size() == 1) {
// single index
- ap.append(generateIndexAnnotation(indexes.get(0)));
+ IndexInspector index = indexes.values().toArray(new IndexInspector[1])[0];
+ ap.append(generateIndexAnnotation(index));
ap.append(eol);
} else {
// multiple indexes
@@ -301,11 +302,11 @@ public class TableInspector {
ap.addParameter("name", index.name);
}
if (!index.type.equals(IndexType.STANDARD)) {
- ap.addParameter("type", IndexType.class.getSimpleName() + "." + index.type.name());
+ ap.addEnum("type", index.type);
}
if (ap.getCount() > 0) {
// multiple fields specified
- ap.addParameter("values", index.columns);
+ ap.addParameter("value", index.columns);
} else {
// default value
ap.addParameter(null, index.columns);
@@ -685,5 +686,14 @@ public class TableInspector {
}
}
}
+
+ void addEnum(String parameter, Enum value) {
+ appendExceptFirst(", ");
+ if (!StringUtils.isNullOrEmpty(parameter)) {
+ append(parameter);
+ append('=');
+ }
+ append(value.getClass().getSimpleName() + "." + value.name());
+ }
}
} \ No newline at end of file