harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r412174 - /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Proxy.java
Date Tue, 06 Jun 2006 16:53:01 GMT
Author: tellison
Date: Tue Jun  6 09:53:01 2006
New Revision: 412174

URL: http://svn.apache.org/viewvc?rev=412174&view=rev
Log:
Convert Proxy.Type to enum.

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Proxy.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Proxy.java?rev=412174&r1=412173&r2=412174&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Proxy.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Proxy.java
Tue Jun  6 09:53:01 2006
@@ -152,75 +152,24 @@
 	}
 
 	/**
-	 * The proxy type, includes <code>DIRECT</code>, <code>HTTP</code>
and
-	 * <code>SOCKS</code>.
-	 */
-	// FIXME: This class needs java 5 Enum feature support. 
-	// The code will be modified when Enum feature is ready. 
-	public static final class Type {
-		/**
-		 * Direct connection. Connect without any proxy.
-		 */
-		public static final Type DIRECT = new Type("DIRECT");
-
-		/**
-		 * HTTP type proxy. It's often used by protocol handlers such as HTTP,
-		 * HTTPS and FTP.
-		 */
-		public static final Type HTTP = new Type("HTTP");
-
-		/**
-		 * SOCKS type proxy.
-		 */
-		public static final Type SOCKS = new Type("SOCKS");
-
-		private String name;
-
-		/*
-		 * Build-in proxy list.
-		 */
-		private static final Type buildInProxyList[] = { DIRECT, HTTP, SOCKS };
-
-		Type(String name) {
-			this.name = name;
-		}
-
-		/**
-		 * Retrieve <code>Proxy</code> by <code>name</code>.
-		 * 
-		 * @throws NullPointerException
-		 *             if <code>name</code> is null.
-		 * @throws IllegalArgumentException
-		 *             if <code>name</code> is not a valid proxy type name.
-		 */
-		public static Proxy.Type valueOf(String name) {
-			if (null == name) {
-				throw new NullPointerException();
-			}
-			for (int i = 0; i < buildInProxyList.length; ++i) {
-				if (buildInProxyList[i].name.equals(name)) {
-					return buildInProxyList[i];
-				}
-			}
-			throw new IllegalArgumentException(name);
-		}
-
-		/**
-		 * Retrieve an array contains all available proxy types. The sequence of
-		 * proxy types is the same as their declaration.
-		 * 
-		 * @return an array contains all available proxy types.
-		 */
-		public static final Proxy.Type[] values() {
-			return buildInProxyList;
-		}
-
-		/**
-		 * @see java.lang.Object#toString()
-		 */
-		public String toString() {
-			return name;
-		}
-
-	}
+     * The proxy type, includes <code>DIRECT</code>, <code>HTTP</code>
and
+     * <code>SOCKS</code>.
+     */
+    public enum Type {
+        /**
+         * Direct connection. Connect without any proxy.
+         */
+        DIRECT,
+
+        /**
+         * HTTP type proxy. It's often used by protocol handlers such as HTTP,
+         * HTTPS and FTP.
+         */
+        HTTP,
+
+        /**
+         * SOCKS type proxy.
+         */
+        SOCKS
+    }
 }



Mime
View raw message