'How can I change the Table class names using the by extending jOOQ's DefaultGeneratorStrategy?
I am using the jooq codgen gradle plugin to change the naming convention for generated tables to include Table
at the end of the class name. However, I am not sure how to distinguish a table from a schema in the generator.
My naming override is:
@Override
public String getJavaClassName(Definition definition, Mode mode) {
String result = super.getJavaClassName(definition, mode);
if (mode == Mode.DEFAULT) {
result += "Table";
}
return result;
}
Is there a way to determine If the current object extends TableImpl
or maybe I need to take a different approach?
Solution 1:[1]
Just use instanceof
checks on your definition
, like this:
@Override
public String getJavaClassName(Definition definition, Mode mode) {
String result = super.getJavaClassName(definition, mode);
if (mode == Mode.DEFAULT && definition instanceof TableDefinition) {
result += "Table";
}
return result;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Lukas Eder |