summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-11-07 09:28:57 -0500
committerJames Moger <james.moger@gitblit.com>2014-11-09 11:15:14 -0500
commitdb0d58c22a0bd4fa2baf023428599757aa4db381 (patch)
tree9199c08f6b4c4eb217cf6ebb732d8ce5d9856a46 /src/test
parent468775706732f3e85af878710aaf95c81f5b60f2 (diff)
downloadiciql-db0d58c22a0bd4fa2baf023428599757aa4db381.tar.gz
iciql-db0d58c22a0bd4fa2baf023428599757aa4db381.zip
Revise type adapter definition to be a separate annotation
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/com/iciql/test/DataTypeAdapterTest.java21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/test/java/com/iciql/test/DataTypeAdapterTest.java b/src/test/java/com/iciql/test/DataTypeAdapterTest.java
index f10d298..d1ccb53 100644
--- a/src/test/java/com/iciql/test/DataTypeAdapterTest.java
+++ b/src/test/java/com/iciql/test/DataTypeAdapterTest.java
@@ -16,6 +16,10 @@
package com.iciql.test;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
import java.util.Date;
import org.junit.After;
@@ -26,6 +30,7 @@ import org.junit.Test;
import com.iciql.Db;
import com.iciql.Iciql.IQColumn;
import com.iciql.Iciql.IQTable;
+import com.iciql.Iciql.TypeAdapter;
import com.iciql.JavaSerializationTypeAdapter;
import com.iciql.test.models.SupportedTypes;
@@ -64,17 +69,18 @@ public class DataTypeAdapterTest extends Assert {
}
- @IQTable
+ @IQTable(name="dataTypeAdapters")
public static class SerializedObjectTypeAdapterTest {
@IQColumn(autoIncrement = true, primaryKey = true)
private long id;
@IQColumn
- private java.util.Date received;
+ public java.util.Date received;
- @IQColumn(typeAdapter = SupportedTypesAdapter.class)
- private SupportedTypes obj;
+ @IQColumn
+ @SupportedTypesAdapter
+ public SupportedTypes obj;
}
@@ -82,7 +88,7 @@ public class DataTypeAdapterTest extends Assert {
* Maps a SupportedType instance to a BLOB using Java Object serialization.
*
*/
- public static class SupportedTypesAdapter extends JavaSerializationTypeAdapter<SupportedTypes> {
+ public static class SupportedTypesAdapterImpl extends JavaSerializationTypeAdapter<SupportedTypes> {
@Override
public Class<SupportedTypes> getJavaType() {
@@ -91,4 +97,9 @@ public class DataTypeAdapterTest extends Assert {
}
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER })
+ @TypeAdapter(SupportedTypesAdapterImpl.class)
+ public @interface SupportedTypesAdapter { }
+
}