diff options
author | James Moger <james.moger@gitblit.com> | 2015-06-30 11:19:48 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2015-06-30 11:19:48 -0400 |
commit | f8e9ed9e35fd8662fa44e537b8e00859c2489c28 (patch) | |
tree | fd6317cf156f58b389fd684e6167e815f32031d3 /src | |
parent | e6646930a1fb77004a844998b82a4afbf22e118b (diff) | |
download | iciql-f8e9ed9e35fd8662fa44e537b8e00859c2489c28.tar.gz iciql-f8e9ed9e35fd8662fa44e537b8e00859c2489c28.zip |
Allow construction of Set, List, and Map fields for DataTypeAdapters
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/iciql/util/Utils.java | 11 |
1 files changed, 11 insertions, 0 deletions
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();
|