| Craig Russell (JIRA) 2007-06-12, 7:11 pm |
|
[ https://issues.apache.org/jira/brow...action_12503965 ]
Craig Russell commented on JDO-403:
-----------------------------------
The annotations containing boolean element types are problematic due to the inability of annotations to properly handle the tri-state "true, false, not-specified". Many of the annotation elements are tri-state, e.g. Field defaultFetchGroup. This defaults
to true for a specific list of field types, and false for the remaining types. The user can override the default.
With annotations, if you define defaultFetchGroup as a boolean type you must either require the user to specify a value or define a default. The problem is that the annotation processor cannot distinguish between the user specifying a value and the defaul
t. So the defaultFetchGroup element is properly defined as String with a default of "".
The issue comes where some of the elements are defined to be boolean and others defined to be String. I think it's confusing for users to have to remember whether they are supposed to type, e.g. @Field(defaultFetchGroup="true") or @Field(defaultFetchGroup
=true).
My preference is to define all of the boolean elements as String. Where the xml defines the default as IMPLIED, the default value is ""; and where the xml defines the default as true, the default value is "true". This gives us the best user experience wit
h the small downside of not having compile-time checking of true/false and the requirement to enclose boolean values in quotes, just like xml.
> JDO2 Annotations
> ----------------
>
> Key: JDO-403
> URL: https://issues.apache.org/jira/browse/JDO-403
> Project: JDO
> Issue Type: New Feature
> Components: api2
> Affects Versions: JDO 2 final
> Reporter: Andy Jefferson
> Assignee: Michelle Caisse
> Fix For: JDO 2 maintenance release 1
>
> Attachments: jdo_2_1_annotations.jar
>
>
> It would be desirable for JDO2 to have its own set of annotations. We have developed a set within JPOX that would likely serve as a starting point for such a set. In my opinion they should be
> 1. Split into javax.jdo.annotations.jdo and javax.jdo.annotations.orm
> 2. Move ORM attributes from some of the JDO annotations and have a ORM annotation.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
|