By default, Scripted Extensions Generate POJOs.groovy doesnβt work very well with underlined tables (which is very common).
Therefore, I made some changes.
Main code
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] }
Here you can find the whole text https://gist.github.com/aristotll/ad799a7462e8b705b26103944cca24a6
aristotll Jul 26 '17 at 4:17 2017-07-26 04:17
source share