I expected that if my database tables names already in the CamelCase form
that I like, generator will preserve this form for the generated class name.
But it is convert names in: first letter in UpperCase and the rest of the
name in LowerCase form. This happens even if table name do not have any
underscore char.
I think that will be more correctly generate class name as close as
possible to the tables name.
The fix is easy.
in the class *org.jooq.tools.StringUtils* at static method* toCamelCase*
check if name does not contains any underscore and if it is correct java
class name use it as is. Else correct and beautify it
smth. like this
public static String toCamelCase(String string) {
StringBuilder result = new StringBuilder();
if(string.indexOf()==-1)
if(Character.isDigit( string.charAt(0)))
string="_" +string;
else
for (String word : string.split("_")) {
// Uppercase first letter of a word
if (word.length() > 0) {
// [#82] - If a word starts with a digit, prevail
the
// underscore to prevent naming clashes
if (Character.isDigit(word.charAt(0))) {
result.append("_");
}
result.append(word.substring(0, 1).toUpperCase());
result.append(word.substring(1).toLowerCase());
}
With best regards ! Sirguy.
--
You received this message because you are subscribed to the Google Groups "jOOQ
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.