db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Jdo Wiki] Update of "Java5FeaturesAndJdo" by mzaun
Date Fri, 18 Nov 2005 17:05:20 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Jdo Wiki" for change notification.

The following page has been changed by mzaun:
http://wiki.apache.org/jdo/Java5FeaturesAndJdo

------------------------------------------------------------------------------
  
  = Enums =
  
-  * as managed field types ...
-  * (as persistence-capable classes ...)
+ Java 5 has introduced linguistic support for enumerated types in form of `enum` declarations,
for example: { { {
+ enum Season { WINTER, SPRING, SUMMER, FALL }
+ } } }
  
+ In Java, `enum` declarations have a number (surprising) features, which exceed their counterparts
in other languages:
+  * An `enum` declaration defines a fully fledged class (dubbed an enum type).
+  * An enum type may have arbitrary methods and fields and may implement arbitrary interfaces.
+  * Enum types have efficient implementations of all the `Object` methods, are `Comparable`
and `Serializable`, and the serial form is designed to withstand arbitrary changes in the
enum type.
+ 
+ To point out commonalities, Java enum types are no different from other user-defined classes,
except that
+  * the number of instances is fixed at compile time,
+  * there are no constructors that can be called,
+  * there's a generated method `static public T[] values()` returning an array of all instances,
+  * there are new, reflective methods for enums, like `Class.isEnum()` and `Class.getEnumConstants()`.
+ 
+ For enum type support in JDO, we have to discuss
+  * enum types as managed field types ...
+  * enum types as persistence-capable classes ...
+  * the new collection types EnumSets and EnumMaps ...
+ 

Mime
View raw message