Author: chris.laprun(a)jboss.com
Date: 2009-10-13 08:32:13 -0400 (Tue, 13 Oct 2009)
New Revision: 337
Modified:
components/common/trunk/common/src/main/java/org/gatein/common/util/ParameterValidation.java
Log:
- Added collection checking methods.
Modified:
components/common/trunk/common/src/main/java/org/gatein/common/util/ParameterValidation.java
===================================================================
---
components/common/trunk/common/src/main/java/org/gatein/common/util/ParameterValidation.java 2009-10-12
15:55:25 UTC (rev 336)
+++
components/common/trunk/common/src/main/java/org/gatein/common/util/ParameterValidation.java 2009-10-13
12:32:13 UTC (rev 337)
@@ -25,7 +25,9 @@
import org.apache.log4j.Logger;
import java.util.Arrays;
+import java.util.Collection;
import java.util.List;
+import java.util.Map;
import java.util.regex.Pattern;
/**
@@ -166,6 +168,16 @@
}
}
+ public static boolean existsAndIsNotEmpty(Collection collection)
+ {
+ return collection != null && !collection.isEmpty();
+ }
+
+ public static boolean existsAndIsNotEmpty(Map map)
+ {
+ return map != null && !map.isEmpty();
+ }
+
/**
* Checks if a given value matches the given format (as a regular expression). If yes,
returns it as is. Otherwise,
* returns the default value.
Show replies by date