You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2008/10/05 16:30:26 UTC

svn commit: r701799 - /geronimo/gshell/trunk/gshell-support/gshell-clp/src/main/java/org/apache/geronimo/gshell/clp/setter/CollectionFieldSetter.java

Author: jdillon
Date: Sun Oct  5 07:30:26 2008
New Revision: 701799

URL: http://svn.apache.org/viewvc?rev=701799&view=rev
Log:
Support any Collection

Modified:
    geronimo/gshell/trunk/gshell-support/gshell-clp/src/main/java/org/apache/geronimo/gshell/clp/setter/CollectionFieldSetter.java

Modified: geronimo/gshell/trunk/gshell-support/gshell-clp/src/main/java/org/apache/geronimo/gshell/clp/setter/CollectionFieldSetter.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-clp/src/main/java/org/apache/geronimo/gshell/clp/setter/CollectionFieldSetter.java?rev=701799&r1=701798&r2=701799&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-clp/src/main/java/org/apache/geronimo/gshell/clp/setter/CollectionFieldSetter.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-clp/src/main/java/org/apache/geronimo/gshell/clp/setter/CollectionFieldSetter.java Sun Oct  5 07:30:26 2008
@@ -27,6 +27,7 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+import java.util.LinkedHashSet;
 
 import org.apache.geronimo.gshell.clp.IllegalAnnotationError;
 
@@ -72,17 +73,18 @@
 
         // If the field is not set, then create a new instance of the collection and set it
         if (obj == null) {
-            if (List.class.isAssignableFrom(field.getType())) {
+            Class type = field.getType();
+
+            if (List.class.isAssignableFrom(type)) {
                 obj = new ArrayList();
             }
-            else if (Set.class.isAssignableFrom(field.getType())) {
-                obj = new HashSet();
+            else if (Set.class.isAssignableFrom(type)) {
+                obj = new LinkedHashSet();
+            }
+            else if (Collection.class.isAssignableFrom(type)) {
+                obj = new ArrayList();
             }
             else {
-                //
-                // TODO: Add support for the default collection types
-                //
-                
                 throw new IllegalAnnotationError("Unsupported collection type: " + field.getType());
             }