← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1007: Implemented method isCollection( Object )

 

------------------------------------------------------------
revno: 1007
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Mon 2009-11-09 14:59:20 +0100
message:
  Implemented method isCollection( Object )
modified:
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ConversionUtils.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription.
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ConversionUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ConversionUtils.java	2009-11-02 15:55:44 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ConversionUtils.java	2009-11-09 13:59:20 +0000
@@ -106,4 +106,24 @@
         
         return Integer.parseInt( string );
     }
+    
+
+    /**
+     * Test whether the object is an array or a Collection.
+     * 
+     * @param value the object.
+     * @return true if the object is an array or a Collection, false otherwise.
+     */
+    public static boolean isCollection( Object value )
+    {
+        if ( value != null )
+        {                    
+            if ( value.getClass().isArray() || value instanceof Collection<?> )
+            {
+                return true;
+            }
+        }
+        
+        return false;
+    }
 }