Totally Aggry with David...
Nirmish.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Harkness,
David
Sent: Tuesday, July 20, 2004 10:56 PM
To: [EMAIL PROTECTED]
Subject: RE: [Xdoclet-user] Generation error in the ejb-jar.xml file
(works in 1.1.2, not in 1.2.1)


Lewis, Grant wrote:
> I have an entity bean that defines the following getter/setter method
> pair in the bean class: 
> 
>     public abstract String getMILSTRIP();
>     public abstract void setMILSTRIP(String milstrip);
> 
> This is not right. The field name should be "mILSTRIP" not
> "MILSTRIP". In 1.1.2, xdoclet generates "mILSTRIP" which is right.

XDoclet (or XJavaDoc, I don't remember) switched its naming conventions
to either use the JavaBeans standard or not use it or use some other
standard. If you search back a few months you'll find the discussion. In
any case, the new rules for forming the field name from the method name,
IIRC, are

1. Strip the prefix (get/set).
2. If it begins with a lowercase letter, use it as is (not verified;
seems reasonable).

     getkey -> key
     getfirstName -> firstName

3. If it begins with a single capital letter followed by at least one
lowercase letter, the first letter is lowercased.

     getKey -> key
     getFirstName -> firstName

4. Otherwise, it begins with more than one uppercase letter, use it as
is.
   This was changed from lowercasing the first letter.

     getID -> ID
     getRFIDTag -> RFIDTag

For reasoning, look at how odd the last examples would be

     getID -> iD
     getRFIDTag -> rFIDTag

For these reasons and after being bit by different rules in different
languages and tools, it has been my style for nearly a decade to always
init-cap acronyms. For example:

     getId -> id
     getRfidTag -> RfidTag
     getMilStrip -> milStrip (if that's two acronyms)
     getMilstrip -> milstrip (if it's one)

This way you aren't dependent on a tool having different rules for
single and multiple initial uppercase letter names. And you get used to
seeing things like UserEjbDto pretty quickly. Also, if you have two
acronyms together, you can tell that by inspection.

David Harkness
Sr. Software Engineer
Sony Pictures Digital Networks
(310) 482-4756


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_idG21&alloc_id040&op=ick
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_idG21&alloc_id040&op=click
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to