On Aug 9, 2007, at 10:56 PM, Andy Jefferson wrote:

As a perhaps lighter-weight variant on Andy's option (2) below, could
we simply provide an alternative, string-based parameter to the
annotation, such as 'customValueStrategy'?

     @Target({ElementType.FIELD, ElementType.METHOD})
     @Retention(RetentionPolicy.RUNTIME)
     public @interface Persistent
     {
         // ...
         IdGeneratorStrategy valueStrategy() default
IdGeneratorStrategy.UNKNOWN;
         String customValueStrategy() default "";
     }

If going for this case a "CUSTOM" value should be added to the enum (rather than using UNKNOWN - which is for where you don't want one, maybe it should
be NONE instead of UNKNOWN), and when it is CUSTOM the user supplies
the "customValueStrategy". Similarly in @DatastoreIdentity "strategy".

This doesn't sound as user-friendly as it could be.

If the user specifies customValueStrategy and leaves valueStrategy empty, is there any doubt as to their intention? So I would not add a CUSTOM setting for valueStrategy.

Clearly if they specify both customValueStrategy and a standard valueStrategy that's an error because you don't know what they want.

Craig

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:[EMAIL PROTECTED]
P.S. A good JDO? O, Gasp!

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to