hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1792651 - /httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/Args.java
Date Tue, 25 Apr 2017 20:33:58 GMT
Author: ggregory
Date: Tue Apr 25 20:33:58 2017
New Revision: 1792651

URL: http://svn.apache.org/viewvc?rev=1792651&view=rev
Log:
Sort members.

Modified:
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/Args.java

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/Args.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/Args.java?rev=1792651&r1=1792650&r2=1792651&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/Args.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/Args.java
Tue Apr 25 20:33:58 2017
@@ -31,10 +31,6 @@ import java.util.Collection;
 
 public class Args {
 
-    private Args() {
-        // Do not allow utility class to be instantiated.
-    }
-
     public static void check(final boolean expression, final String message) {
         if (!expression) {
             throw new IllegalArgumentException(message);
@@ -53,20 +49,16 @@ public class Args {
         }
     }
 
-    public static <T> T notNull(final T argument, final String name) {
-        if (argument == null) {
-            throw new IllegalArgumentException(name + " may not be null");
-        }
-        return argument;
-    }
-
-    public static <T extends CharSequence> T notEmpty(final T argument, final String
name) {
+    public static <T extends CharSequence> T containsNoBlanks(final T argument, final
String name) {
         if (argument == null) {
             throw new IllegalArgumentException(name + " may not be null");
         }
-        if (TextUtils.isEmpty(argument)) {
+        if (argument.length() == 0) {
             throw new IllegalArgumentException(name + " may not be empty");
         }
+        if (TextUtils.containsBlanks(argument)) {
+            throw new IllegalArgumentException(name + " may not contain blanks");
+        }
         return argument;
     }
 
@@ -80,16 +72,13 @@ public class Args {
         return argument;
     }
 
-    public static <T extends CharSequence> T containsNoBlanks(final T argument, final
String name) {
+    public static <T extends CharSequence> T notEmpty(final T argument, final String
name) {
         if (argument == null) {
             throw new IllegalArgumentException(name + " may not be null");
         }
-        if (argument.length() == 0) {
+        if (TextUtils.isEmpty(argument)) {
             throw new IllegalArgumentException(name + " may not be empty");
         }
-        if (TextUtils.containsBlanks(argument)) {
-            throw new IllegalArgumentException(name + " may not contain blanks");
-        }
         return argument;
     }
 
@@ -103,32 +92,43 @@ public class Args {
         return argument;
     }
 
-    public static int positive(final int n, final String name) {
-        if (n <= 0) {
-            throw new IllegalArgumentException(name + " may not be negative or zero");
+    public static int notNegative(final int n, final String name) {
+        if (n < 0) {
+            throw new IllegalArgumentException(name + " may not be negative");
         }
         return n;
     }
 
-    public static long positive(final long n, final String name) {
-        if (n <= 0) {
-            throw new IllegalArgumentException(name + " may not be negative or zero");
+    public static long notNegative(final long n, final String name) {
+        if (n < 0) {
+            throw new IllegalArgumentException(name + " may not be negative");
         }
         return n;
     }
 
-    public static int notNegative(final int n, final String name) {
-        if (n < 0) {
-            throw new IllegalArgumentException(name + " may not be negative");
+    public static <T> T notNull(final T argument, final String name) {
+        if (argument == null) {
+            throw new IllegalArgumentException(name + " may not be null");
+        }
+        return argument;
+    }
+
+    public static int positive(final int n, final String name) {
+        if (n <= 0) {
+            throw new IllegalArgumentException(name + " may not be negative or zero");
         }
         return n;
     }
 
-    public static long notNegative(final long n, final String name) {
-        if (n < 0) {
-            throw new IllegalArgumentException(name + " may not be negative");
+    public static long positive(final long n, final String name) {
+        if (n <= 0) {
+            throw new IllegalArgumentException(name + " may not be negative or zero");
         }
         return n;
     }
 
+    private Args() {
+        // Do not allow utility class to be instantiated.
+    }
+
 }



Mime
View raw message