From f8e9ed9e35fd8662fa44e537b8e00859c2489c28 Mon Sep 17 00:00:00 2001 From: James Moger Date: Tue, 30 Jun 2015 11:19:48 -0400 Subject: Allow construction of Set, List, and Map fields for DataTypeAdapters --- src/main/java/com/iciql/util/Utils.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/main') 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(); -- cgit v1.2.3