From f8e9ed9e35fd8662fa44e537b8e00859c2489c28 Mon Sep 17 00:00:00 2001 From: James Moger Date: Tue, 30 Jun 2015 11:19:48 -0400 Subject: [PATCH] Allow construction of Set, List, and Map fields for DataTypeAdapters --- build.moxie | 2 +- releases.moxie | 6 ++++-- src/main/java/com/iciql/util/Utils.java | 11 +++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/build.moxie b/build.moxie index e161bae..c8aac51 100644 --- a/build.moxie +++ b/build.moxie @@ -10,7 +10,7 @@ name: Iciql description: 'a model-based database access wrapper for JDBC' groupId: com.iciql artifactId: iciql -version: 1.7.0-SNAPSHOT +version: 1.6.4-SNAPSHOT packaging: jar+zip inceptionYear: 2011 diff --git a/releases.moxie b/releases.moxie index f2cf70d..03f2d9e 100644 --- a/releases.moxie +++ b/releases.moxie @@ -11,9 +11,11 @@ r28: { security: ~ fixes: ~ changes: ~ - additions: ~ + additions: + - Support Set, List, and Map types for columns when used with DataTypeAdapter dependencyChanges: ~ - contributors: ~ + contributors: + - James Moger } # diff --git a/src/main/java/com/iciql/util/Utils.java b/src/main/java/com/iciql/util/Utils.java index f4dbb81..ada7c34 100644 --- a/src/main/java/com/iciql/util/Utils.java +++ b/src/main/java/com/iciql/util/Utils.java @@ -37,7 +37,9 @@ import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.IdentityHashMap; +import java.util.List; import java.util.Map; +import java.util.Set; import java.util.UUID; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; @@ -191,6 +193,15 @@ public class Utils { } else if (clazz == java.util.UUID.class) { COUNTER.getAndIncrement(); return (T) UUID.randomUUID(); + } else if (Set.class == clazz) { + COUNTER.getAndIncrement(); + return (T) new HashSet(); + } else if (List.class == clazz) { + COUNTER.getAndIncrement(); + return (T) new ArrayList(); + } else if (Map.class == clazz) { + COUNTER.getAndIncrement(); + return (T) new HashMap(); } try { return clazz.newInstance(); -- 2.39.5