summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Moger <james.moger@gmail.com>2011-08-12 14:15:57 -0400
committerJames Moger <james.moger@gmail.com>2011-08-12 14:15:57 -0400
commit783797ff9ddfafa19481fda5295fcacd3c9b51cd (patch)
tree6e4902561c5fabdfdc3e776629085375a470998e /src
parentbb6d90fe0caa40a54ffb44e36289af4d2c708644 (diff)
downloadiciql-783797ff9ddfafa19481fda5295fcacd3c9b51cd.tar.gz
iciql-783797ff9ddfafa19481fda5295fcacd3c9b51cd.zip
Always enforce strict type mapping.
Diffstat (limited to 'src')
-rw-r--r--src/com/iciql/Iciql.java7
-rw-r--r--src/com/iciql/ModelUtils.java7
-rw-r--r--src/com/iciql/TableDefinition.java4
3 files changed, 2 insertions, 16 deletions
diff --git a/src/com/iciql/Iciql.java b/src/com/iciql/Iciql.java
index 47cf9c1..2917882 100644
--- a/src/com/iciql/Iciql.java
+++ b/src/com/iciql/Iciql.java
@@ -344,13 +344,6 @@ public interface Iciql {
boolean create() default true;
/**
- * Whether only supported types are mapped. If true, unsupported mapped
- * types will throw an IciqlException. If false, unsupported mapped
- * types will default to VARCHAR. Default: true.
- */
- boolean strictTypeMapping() default true;
-
- /**
* If true, only fields that are explicitly annotated as IQColumn are
* mapped. Default: true.
*/
diff --git a/src/com/iciql/ModelUtils.java b/src/com/iciql/ModelUtils.java
index 441bca7..048ce8d 100644
--- a/src/com/iciql/ModelUtils.java
+++ b/src/com/iciql/ModelUtils.java
@@ -146,11 +146,9 @@ class ModelUtils {
*
* @param fieldDef
* the field to map
- * @param strictTypeMapping
- * throws a IciqlException if type is unsupported
* @return
*/
- static String getDataType(FieldDefinition fieldDef, boolean strictTypeMapping) {
+ static String getDataType(FieldDefinition fieldDef) {
Class<?> fieldClass = fieldDef.field.getType();
if (fieldClass.isEnum()) {
switch (fieldDef.enumType) {
@@ -165,9 +163,6 @@ class ModelUtils {
if (SUPPORTED_TYPES.containsKey(fieldClass)) {
return SUPPORTED_TYPES.get(fieldClass);
}
- if (!strictTypeMapping) {
- return "VARCHAR";
- }
throw new IciqlException("Unsupported type " + fieldClass.getName());
}
diff --git a/src/com/iciql/TableDefinition.java b/src/com/iciql/TableDefinition.java
index 36a28d3..03345d4 100644
--- a/src/com/iciql/TableDefinition.java
+++ b/src/com/iciql/TableDefinition.java
@@ -261,12 +261,10 @@ public class TableDefinition<T> {
void mapFields() {
boolean byAnnotationsOnly = false;
boolean inheritColumns = false;
- boolean strictTypeMapping = false;
if (clazz.isAnnotationPresent(IQTable.class)) {
IQTable tableAnnotation = clazz.getAnnotation(IQTable.class);
byAnnotationsOnly = tableAnnotation.annotationsOnly();
inheritColumns = tableAnnotation.inheritColumns();
- strictTypeMapping = tableAnnotation.strictTypeMapping();
}
List<Field> classFields = Utils.newArrayList();
@@ -356,7 +354,7 @@ public class TableDefinition<T> {
fieldDef.nullable = nullable;
fieldDef.defaultValue = defaultValue;
fieldDef.enumType = enumType;
- fieldDef.dataType = ModelUtils.getDataType(fieldDef, strictTypeMapping);
+ fieldDef.dataType = ModelUtils.getDataType(fieldDef);
fields.add(fieldDef);
}
}