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?
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;
}