You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by sc...@apache.org on 2009/10/24 13:23:53 UTC

svn commit: r829345 - /commons/proper/lang/trunk/src/java/org/apache/commons/lang/Validate.java

Author: scolebourne
Date: Sat Oct 24 11:23:53 2009
New Revision: 829345

URL: http://svn.apache.org/viewvc?rev=829345&view=rev
Log:
Reorder methods and adjust Javadoc

Modified:
    commons/proper/lang/trunk/src/java/org/apache/commons/lang/Validate.java

Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/Validate.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/Validate.java?rev=829345&r1=829344&r2=829345&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/Validate.java (original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/Validate.java Sat Oct 24 11:23:53 2009
@@ -46,7 +46,7 @@
     public Validate() {
       super();
     }
-    
+
     // isTrue
     //---------------------------------------------------------------------------------
 
@@ -296,45 +296,6 @@
         notEmpty(collection, "The validated collection is empty");
     }
 
-    /**
-     * <p>Validate an argument, throwing <code>IllegalArgumentException</code>
-     * if the argument String is blank (<code>null</code>, empty or whitespace).</p>
-     *
-     * <pre>
-     * Validate.notBlank(myString);
-     * </pre>
-     *
-     * <p>The message in the exception is 'The validated string is blank'.</p>
-     *
-     * @param string  the string to check is not blank
-     * @throws IllegalArgumentException if the string is blank
-     * @see StringUtils#isBlank(CharSequence)
-     */
-    public static void notBlank(String string) {
-        if(StringUtils.isBlank(string)) {
-            throw new IllegalArgumentException("The validated string is blank");
-        }
-    }
-
-    /**
-     * <p>Validate an argument, throwing <code>IllegalArgumentException</code>
-     * if the argument String is blank (<code>null</code>, empty or whitespace).</p>
-     *
-     * <pre>
-     * Validate.notBlank(myString, "The string must not be blank");
-     * </pre>
-     *
-     * @param string  the string to check is not blank
-     * @param message  the exception message you would like to see if the string is blank
-     * @throws IllegalArgumentException if the string is blank
-     * @see StringUtils#isBlank(CharSequence)
-     */
-    public static void notBlank(String string, String message) {
-        if(StringUtils.isBlank(string)) {
-            throw new IllegalArgumentException(message);
-        }
-    }
-
     // notEmpty map
     //---------------------------------------------------------------------------------
 
@@ -411,6 +372,48 @@
         notEmpty(string, "The validated string is empty");
     }
 
+    // notBlank string
+    //---------------------------------------------------------------------------------
+
+    /**
+     * <p>Validate an argument, throwing <code>IllegalArgumentException</code>
+     * if the argument String is blank (<code>null</code>, empty or whitespace).</p>
+     *
+     * <pre>
+     * Validate.notBlank(myString);
+     * </pre>
+     *
+     * <p>The message in the exception is 'The validated string is blank'.</p>
+     *
+     * @param string  the string to check is not blank
+     * @throws IllegalArgumentException if the string is blank
+     * @see StringUtils#isBlank(CharSequence)
+     */
+    public static void notBlank(String string) {
+        if (StringUtils.isBlank(string)) {
+            throw new IllegalArgumentException("The validated string is blank");
+        }
+    }
+
+    /**
+     * <p>Validate an argument, throwing <code>IllegalArgumentException</code>
+     * if the argument String is blank (<code>null</code>, empty or whitespace).</p>
+     *
+     * <pre>
+     * Validate.notBlank(myString, "The string must not be blank");
+     * </pre>
+     *
+     * @param string  the string to check is not blank
+     * @param message  the exception message you would like to see if the string is blank
+     * @throws IllegalArgumentException if the string is blank
+     * @see StringUtils#isBlank(CharSequence)
+     */
+    public static void notBlank(String string, String message) {
+        if (StringUtils.isBlank(string)) {
+            throw new IllegalArgumentException(message);
+        }
+    }
+
     // notNullElements array
     //---------------------------------------------------------------------------------
 
@@ -561,10 +564,8 @@
      * The message in the exception is 'The validated collection contains an element not of type clazz at index: '.
      * </p>
      * 
-     * @param collection
-     *            the collection to check, not null
-     * @param clazz
-     *            the <code>Class</code> which the collection's elements are expected to be, not null
+     * @param collection  the collection to check, not null
+     * @param clazz  the <code>Class</code> which the collection's elements are expected to be, not null
      * @since 2.1
      */
     public static void allElementsOfType(Collection<?> collection, Class<?> clazz) {