db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject Re: Annotation enum : IdGeneratorStrategy
Date Fri, 10 Aug 2007 15:35:49 GMT

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 Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!

View raw message