I've started to play around with the torque stuff. I noticed that
if I use the proper naming scheme for variables (i.e. first letter
lower case, upper case for the first letter of subsequent words, e.g.
firstName, optionGroupDateId), XMLSchemaToObjectModel.java will
not preserve this.
I would like to propose, that we preserve the case that the writer of the
xml file uses. (other than we don't capitalize the first letter other than
for the class name itself).
otherwise we see stuff like this:
public int getOptiongroupdateid()
instead of
public int getOptionGroupDateId()
Below is the patch that I use; any chance we can get it in cvs ?
thanks !
mike haberman
--- XMLSchemaToObjectModel.java Thu Oct 26 17:29:38 2000
+++ XMLSchemaToObjectModel.java.bak Thu Oct 26 17:29:24 2000
@@ -596,16 +596,25 @@
}
/**
- * Makes the first letter caps and the rest lowercase.
+ * Makes the first letter caps
*
* @param data A String.
* @return A new String with the said processing applied.
*/
private String firstLetterCaps (String data)
{
- String firstLetter = data.substring(0, 1).toUpperCase();
- String restLetters = data.substring(1).toLowerCase();
- return firstLetter + restLetters;
+ return data.substring(0, 1).toUpperCase() + data.substring(1);
+ }
+
+ /**
+ * Makes the first letter lower case
+ *
+ * @param data A String.
+ * @return A new String with the said processing applied.
+ */
+ private String firstLetterLower (String data)
+ {
+ return data.substring(0, 1).toLowerCase() + data.substring(1);
}
/**
@@ -1075,8 +1084,9 @@
String type = getJavaType(cmap.getType());
String realColumnName =
getColumnName(cmap.getColumnName());
- String field =
- removeUnderScores(realColumnName).toLowerCase();
+ String field = removeUnderScores(realColumnName);
+
+ field = firstLetterLower(field);
pw.println(" /** the value for the " + field +
" field */");
@@ -1093,7 +1103,7 @@
String realColumnName =
getColumnName(cmap.getColumnName());
String field = removeUnderScores(realColumnName);
String type = getJavaType(cmap.getType());
- String fieldlower = field.toLowerCase();
+ String fieldlower = firstLetterLower(field);
// Get.
pw.println(" /**");
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]