Updated Branches:
  refs/heads/master b0118c114 -> 57a09fbe6

change 'void' methods to pass-through checked argument


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/57a09fbe
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/57a09fbe
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/57a09fbe

Branch: refs/heads/master
Commit: 57a09fbe6321921e805f721766dd1559808fef92
Parents: b0118c1
Author: Peter Ertl <[email protected]>
Authored: Fri Feb 10 23:41:27 2012 +0100
Committer: Peter Ertl <[email protected]>
Committed: Fri Feb 10 23:41:27 2012 +0100

----------------------------------------------------------------------
 .../java/org/apache/wicket/util/lang/Args.java     |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/57a09fbe/wicket-util/src/main/java/org/apache/wicket/util/lang/Args.java
----------------------------------------------------------------------
diff --git a/wicket-util/src/main/java/org/apache/wicket/util/lang/Args.java 
b/wicket-util/src/main/java/org/apache/wicket/util/lang/Args.java
index ce9d60b..f64900d 100644
--- a/wicket-util/src/main/java/org/apache/wicket/util/lang/Args.java
+++ b/wicket-util/src/main/java/org/apache/wicket/util/lang/Args.java
@@ -77,13 +77,14 @@ public class Args
         * @throws IllegalArgumentException
         *             if the passed collection is either null or empty
         */
-       public static void notEmpty(final Collection<?> collection, final 
String message,
+       public static <T extends Collection<?>> T notEmpty(final T collection, 
final String message,
                final Object... params)
        {
                if (collection == null || collection.isEmpty())
                {
                        throw new IllegalArgumentException(Args.format(message, 
params));
                }
+               return collection;
        }
 
        /**
@@ -94,9 +95,9 @@ public class Args
         * @throws IllegalArgumentException
         *             if the passed collection is either null or empty
         */
-       public static void notEmpty(final Collection<?> collection, final 
String name)
+       public static <T extends Collection<?>> T notEmpty(final T collection, 
final String name)
        {
-               notEmpty(collection, "Collection '%s' may not be null or 
empty.", name);
+               return notEmpty(collection, "Collection '%s' may not be null or 
empty.", name);
        }
 
        /**
@@ -109,7 +110,7 @@ public class Args
         * @param name
         * @throws IllegalArgumentException
         */
-       public static <T extends Comparable<T>> void withinRange(final T min, 
final T max,
+       public static <T extends Comparable<T>> T withinRange(final T min, 
final T max,
                final T value, final String name)
        {
                notNull(min, name);
@@ -120,6 +121,7 @@ public class Args
                                String.format("Argument '%s' must have a value 
within [%s,%s], but was %s", name,
                                        min, max, value));
                }
+               return value;
        }
 
        /**

Reply via email to