Значение по умолчанию Scripted Extensions Generate POJOs.groovy
не очень хорошо при работе с таблицами с подчеркиванием (что очень часто встречается).
Поэтому я делаю некоторые модификации.
Основной код
def calcFields(DasObject table) {
DasUtil.getColumns(table).reduce([]) { fields, col ->
def spec = Case.LOWER.apply(col.dataType.specification)
def typeStr = typeMapping.find { p, t -> p.matcher(spec).find() }.value
fields += [[
name : javaName(col.name, false),
type : typeStr,
annos: """
/**
* $col.comment
*/"""]]
}
}
static String javaName(String str, boolean capitalize) {
def s = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, str);
capitalize || s.length() == 1 ? s : Case.LOWER.apply(s[0]) + s[1..-1]
}
Вы можете найти всю суть здесь https://gist.github.com/aristotll/ad799a7462e8b705b26103944cca24a6