incubator-graffito-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apope...@apache.org
Subject svn commit: r384314 - in /incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/collectionconverter: ManageableCollectionUtil.java impl/ManageableSet.java
Date Wed, 08 Mar 2006 20:10:48 GMT
Author: apopescu
Date: Wed Mar  8 12:10:47 2006
New Revision: 384314

URL: http://svn.apache.org/viewcvs?rev=384314&view=rev
Log:
Set collection support added

Added:
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/ManageableSet.java
Modified:
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/collectionconverter/ManageableCollectionUtil.java

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/collectionconverter/ManageableCollectionUtil.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/collectionconverter/ManageableCollectionUtil.java?rev=384314&r1=384313&r2=384314&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/collectionconverter/ManageableCollectionUtil.java
(original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/collectionconverter/ManageableCollectionUtil.java
Wed Mar  8 12:10:47 2006
@@ -19,11 +19,14 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 import java.util.Vector;
 
 import org.apache.portals.graffito.jcr.exception.JcrMappingException;
 import org.apache.portals.graffito.jcr.persistence.collectionconverter.impl.ManageableArrayList;
+import org.apache.portals.graffito.jcr.persistence.collectionconverter.impl.ManageableSet;
 import org.apache.portals.graffito.jcr.persistence.collectionconverter.impl.ManageableVector;
 
 /**
@@ -69,10 +72,18 @@
                 return new ManageableVector();
             }
 
+            if (collectionClass.equals(HashSet.class)) {
+                return new ManageableSet();
+            }
+            
             if (collectionClass.equals(Collection.class) || collectionClass.equals(List.class))
{
                 return new ManageableArrayList();
             }
 
+            if (collectionClass.equals(Set.class)) {
+                return new ManageableSet();
+            }
+            
             Object collection = collectionClass.newInstance();
             if (!(collection instanceof ManageableCollection)) {
                 throw new JcrMappingException("Unsupported collection type :"
@@ -121,12 +132,19 @@
                 return manageableVector;
             }
 
+            if (object.getClass().equals(HashSet.class)) {
+                return new ManageableSet((Set) object);
+            }
+            
             if (object.getClass().equals(Collection.class)
                 || object.getClass().equals(List.class)) {
                 ManageableArrayList manageableArrayList = new ManageableArrayList();
                 manageableArrayList.addAll((Collection) object);
 
                 return manageableArrayList;
+            }
+            if (object.getClass().equals(Set.class)) {
+                return new ManageableSet((Set) object);
             }
         }
         catch (Exception e) {

Added: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/ManageableSet.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/ManageableSet.java?rev=384314&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/ManageableSet.java
(added)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/ManageableSet.java
Wed Mar  8 12:10:47 2006
@@ -0,0 +1,42 @@
+package org.apache.portals.graffito.jcr.persistence.collectionconverter.impl;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import org.apache.portals.graffito.jcr.persistence.collectionconverter.ManageableCollection;
+
+
+/**
+ * This class/interface 
+ */
+public class ManageableSet extends HashSet implements ManageableCollection {
+    public ManageableSet() {
+    }
+    
+    public ManageableSet(Collection collection) {
+        super(collection);
+    }
+    
+    /**
+     * @see org.apache.portals.graffito.jcr.persistence.collectionconverter.ManageableCollection#addObject(java.lang.Object)
+     */
+    public void addObject(Object object) {
+        add(object);
+    }
+
+    /**
+     * @see org.apache.portals.graffito.jcr.persistence.collectionconverter.ManageableCollection#getIterator()
+     */
+    public Iterator getIterator() {
+        return iterator();
+    }
+
+    /**
+     * @see org.apache.portals.graffito.jcr.persistence.collectionconverter.ManageableCollection#getSize()
+     */
+    public int getSize() {
+        return size();
+    }
+
+}



Mime
View raw message