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 CraigRussell
Date Mon, 21 Nov 2005 17:23:13 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 CraigRussell:
http://wiki.apache.org/jdo/Java5FeaturesAndJdo

------------------------------------------------------------------------------
  
  = Generics =
  
-  * as managed field types ...
+  * generics as persistent field types ...
+ JDO implementations need the information about field types that in JDO 1 is provided by
the metadata element collection and map. The user can specify the type of the elements of
the collection and the types of the key and value of the map. For example, {{{
+ class Employee {
+ ...
+ Map<Project, Integer> projectNumbers;
+ Set<Skill> skillSet;
+ ...
+ }
+ }}}
+  * generics with wildcards as persistent field types...
+ Generic wildcards allow the user to bound the types of persistent collection elements, or
map keys and values. For example, if we know that a {{{Set}}} can only contain {{{Number}}}
elements, we might declare it as a {{{Set<? extends Number> skills;}}}. Mapping this
persistent field to the datastore is similar to the issue of mapping a field of a superclass
to the datastore, e.g. {{{Number skill;}}}. And it is similar to mapping {{{Set<Number>}}}.
We believe that as far as JDO is concerned, the implementation can consider {{{Set<? extends
Number>}}} exactly as {{{Set<Number>}}}.
+  * fields of type identifier type ...
+ The only implementation class for type identifiers is Class, which cannot be persistent.
We plan to wait until a use-case is developed. 
+  * generics arrays ...
   * as persistence-capable classes ...
+ This usage is not well-defined. It seems that most uses would involve some kind of wrapper
or holder that was type-specific. We plan to wait until a use-case is developed.
-  * wildcards ...
-  * fields of type identifier type ...
-  * generics arrays ...
  
  = Enums =
  
- Java 5 has introduced linguistic support for enumerated types in form of `enum` declarations,
for example: { { {
+ Java 5 has introduced linguistic support for enumerated types in form of `enum` declarations,
for example: {{{
- enum Season { WINTER, SPRING, SUMMER, FALL }
+ 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).

Mime
View raw message