You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2017/05/09 19:58:17 UTC

[25/50] [abbrv] httpcomponents-core git commit: Sort members.

Sort members.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk@1792651 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/cb20293c
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/cb20293c
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/cb20293c

Branch: refs/heads/trunk
Commit: cb20293c98e0f954f5c48a621dc492ea41522bce
Parents: fee8ab4
Author: Gary D. Gregory <gg...@apache.org>
Authored: Tue Apr 25 20:33:58 2017 +0000
Committer: Gary D. Gregory <gg...@apache.org>
Committed: Tue Apr 25 20:33:58 2017 +0000

----------------------------------------------------------------------
 .../java/org/apache/hc/core5/util/Args.java     | 60 ++++++++++----------
 1 file changed, 30 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/cb20293c/httpcore5/src/main/java/org/apache/hc/core5/util/Args.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/util/Args.java b/httpcore5/src/main/java/org/apache/hc/core5/util/Args.java
index 479c0da..f6fc05f 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/util/Args.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/util/Args.java
@@ -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.
+    }
+
 }