Title: Underscores in element names...

Hello,

I have just recently begun to evaluate Castor.  Previously, I have been using JAXB, but have run into some problems.  One nice thing about JAXB is that element_name gets turned into setElementName and getElementName with an ElementName.class.

Would it be possible to change SourceGenerator.java to allow for a property that would say to remove underscores and change the letter after the underscore to uppercase?  Of course, the actual code behind this would have to live somewhere as well!  >From my source perusing, I would say that this code would need to go in the JavaNaming.toJavaName(...) method.  It would need to go inside of the code snippet below (I included thought-code, not really tested).  Any comments/suggetions/advice appreciated.

        for (int i = 0; i < size; i++) {
            char ch = ncChars[i];

            switch(ch) {
                case '.':
                                case ' ':
                    ncChars[next++] = '_';
                    break;
                case ':':
                case '-':
                    uppercase = true;
                    break;
/* new as of yet untried code starts here */
                case '_':
                          if (SourceGenerator.newPropetiesFileProperty()) {
                        uppercase = true;
                                ++next; // This will eat the "_"
                          } else {
                      ncChars[next] = ch;
                      ++next;
                        }
                    break;
/* new as of yet untried code ends here */
                default:
                    if (uppercase) {
                        ncChars[next] = Character.toUpperCase(ch);
                        uppercase = false;
                    }
                    else if (lowercase) {
                        ncChars[next] = Character.toLowerCase(ch);
                        lowercase = false;
                    }
                    else ncChars[next] = ch;
                    ++next;
                    break;
            }
        }

Mr. Brooke Hedrick
Programmer Analyst
Rain & Hail LLC
Phone: (515) 559-1322
Fax: (810) 283-6138
http://www.rainhail.com/
mailto:[EMAIL PROTECTED]

Reply via email to