harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r412185 - /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Authenticator.java
Date Tue, 06 Jun 2006 18:33:54 GMT
Author: tellison
Date: Tue Jun  6 11:33:53 2006
New Revision: 412185

URL: http://svn.apache.org/viewvc?rev=412185&view=rev
Log:
Convert Authenticator.RequestorType to an enum

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Authenticator.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Authenticator.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Authenticator.java?rev=412185&r1=412184&r2=412185&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Authenticator.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Authenticator.java
Tue Jun  6 11:33:53 2006
@@ -325,57 +325,18 @@
 	}
 
 	/**
-	 * an enum class of requestor type
-	 * 
-	 */
-	// FIXME: This class needs java 5 Enum feature support.
-	// The code will be modified when Enum feature is ready.
-	public static final class RequestorType {
-
-		private String name;
-
-		/**
-		 * type of proxy server
-		 */
-		public static final Authenticator.RequestorType PROXY = new RequestorType(
-				"PROXY"); //$NON-NLS-1$
-
-		/**
-		 * type of origin server
-		 */
-		public static final Authenticator.RequestorType SERVER = new RequestorType(
-				"SERVER"); //$NON-NLS-1$
-
-		private static final RequestorType[] rt = { PROXY, SERVER };
-
-		private RequestorType(String name) {
-			this.name = name;
-		}
-
-		/**
-		 * 
-		 * @return an array of requestor types
-		 */
-		public static final RequestorType[] values() {
-			return rt;
-		}
-
-		/**
-		 * 
-		 * @param name
-		 *            requestor types name
-		 * @return a requestor type according to name if exist
-		 */
-		public static RequestorType valueOf(String name) {
-			if (null == name) {
-				throw new NullPointerException();
-			}
-			for (int i = 0; i < rt.length; i++) {
-				if (rt[i].name.equals(name)) {
-					return rt[i];
-				}
-			}
-			throw new IllegalArgumentException(name);
-		}
-	}
+     * an enum class of requestor type
+     */
+    public enum RequestorType {
+
+        /**
+         * type of proxy server
+         */
+        PROXY,
+
+        /**
+         * type of origin server
+         */
+        SERVER
+    }
 }



Mime
View raw message