commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r751344 - /commons/proper/lang/trunk/src/java/org/apache/commons/lang/enums/package.html
Date Sun, 08 Mar 2009 01:07:18 GMT
Author: bayard
Date: Sun Mar  8 01:07:17 2009
New Revision: 751344

URL: http://svn.apache.org/viewvc?rev=751344&view=rev
Log:
Documenting future of enums

Modified:
    commons/proper/lang/trunk/src/java/org/apache/commons/lang/enums/package.html

Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/enums/package.html
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enums/package.html?rev=751344&r1=751343&r2=751344&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/enums/package.html (original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/enums/package.html Sun Mar
 8 01:07:17 2009
@@ -50,5 +50,19 @@
 }
 </pre>
 @since 2.1
+<h2>Migration to Java5</h2>
+<p>Java now provides Enums and the existing code can go away, with the following code
changes. </p>
+
+<p>Firstly rewrite your enum as a Java enum.  See the 
+  <a href="http://java.sun.com/docs/books/tutorial/java/javaOO/enum.html">Java tutorial</a>
for more. </p>
+
+<p>Then change the following: </p>
+
+<pre>
+  getEnum     -> valueOf
+  getEnumList -> new ArrayList( EnumSet.allOf(enumClass) ) // or just use an EnumSet
+  iterator    -> EnumSet.allOf(...).iterator()
+  getEnumMap  -> org.apache.commons.lang.EnumUtils.asMap(enumClass)
+</pre>
 </body>
 </html>



Mime
View raw message