Мне нужно поместить комментарии // @formatter:on
и // @formatter:off
сверху и снизу каждого класса, сгенерированного jOOQ.Я создал класс JavaGenerator
следующим образом:
package ch.acme.backend.server.metamodel
import org.jooq.codegen.JavaGenerator
import org.jooq.codegen.JavaWriter
import org.jooq.meta.ArrayDefinition
import org.jooq.meta.EnumDefinition
import org.jooq.meta.PackageDefinition
import org.jooq.meta.RoutineDefinition
import org.jooq.meta.SchemaDefinition
import org.jooq.meta.TableDefinition
import org.jooq.meta.UDTDefinition
class NoFormatJavaGenerator : JavaGenerator() {
override fun generateRecordClassJavadoc(table: TableDefinition, out: JavaWriter) {
out.println("// @formatter:off")
}
override fun generateArrayClassJavadoc(arrayDefinition: ArrayDefinition, out: JavaWriter) {
out.println("// @formatter:off")
}
override fun generateDaoClassJavadoc(table: TableDefinition, out: JavaWriter) {
out.println("// @formatter:off")
}
override fun generateEnumClassJavadoc(enum: EnumDefinition, out: JavaWriter) {
out.println("// @formatter:off")
}
override fun generateInterfaceClassJavadoc(table: TableDefinition, out: JavaWriter) {
out.println("// @formatter:off")
}
override fun generatePackageClassJavadoc(pkg: PackageDefinition, out: JavaWriter) {
out.println("// @formatter:off")
}
override fun generatePojoClassJavadoc(table: TableDefinition, out: JavaWriter) {
out.println("// @formatter:off")
}
override fun generateRoutineClassJavadoc(routine: RoutineDefinition, out: JavaWriter) {
out.println("// @formatter:off")
}
override fun generateSchemaClassJavadoc(schema: SchemaDefinition, out: JavaWriter) {
out.println("// @formatter:off")
}
override fun generateTableClassJavadoc(table: TableDefinition, out: JavaWriter) {
out.println("// @formatter:off")
}
override fun generateUDTClassJavadoc(udt: UDTDefinition, out: JavaWriter) {
out.println("// @formatter:off")
}
override fun generateUDTRecordClassJavadoc(udt: UDTDefinition, out: JavaWriter) {
out.println("// @formatter:off")
}
override fun generateRecordClassFooter(table: TableDefinition, out: JavaWriter) {
out.println("// @formatter:on")
}
override fun generateArrayClassFooter(arrayDefinition: ArrayDefinition, out: JavaWriter) {
out.println("// @formatter:on")
}
override fun generateDaoClassFooter(table: TableDefinition, out: JavaWriter) {
out.println("// @formatter:on")
}
override fun generateEnumClassFooter(enum: EnumDefinition, out: JavaWriter) {
out.println("// @formatter:on")
}
override fun generateInterfaceClassFooter(table: TableDefinition, out: JavaWriter) {
out.println("// @formatter:on")
}
override fun generatePackageClassFooter(pkg: PackageDefinition, out: JavaWriter) {
out.println("// @formatter:on")
}
override fun generatePojoClassFooter(table: TableDefinition, out: JavaWriter) {
out.println("// @formatter:on")
}
override fun generateRoutineClassFooter(routine: RoutineDefinition, out: JavaWriter) {
out.println("// @formatter:on")
}
override fun generateSchemaClassFooter(schema: SchemaDefinition, out: JavaWriter) {
out.println("// @formatter:on")
}
override fun generateTableClassFooter(table: TableDefinition, out: JavaWriter) {
out.println("// @formatter:on")
}
override fun generateUDTClassFooter(udt: UDTDefinition, out: JavaWriter) {
out.println("// @formatter:on")
}
override fun generateUDTRecordClassFooter(udt: UDTDefinition, out: JavaWriter) {
out.println("// @formatter:on")
}
}
Это работает для большинства файлов, но «DefaultCatalog», «Indexes», «Keys», «Public» и «Tables» не затрагиваютсяэтим.Как я могу добавить их тоже?