注释
适用于 ❌ 开源版 ✅ Express 版 ✅ 专业版 ✅ 企业版
jOOQ的代码生成器将获取使用COMMENT 语句创建的模式对象的注释,并相应地生成 Javadoc。
如果你的方言不支持 COMMENT
语句,或者你的模式没有注释,或者你想在代码生成器中修改/替换模式注释,本节将向你展示如何向模式对象添加“合成”注释。
XML(独立和 Maven)
编程方式
Gradle (Kotlin)
Gradle (Groovy)
Gradle(第三方)
<configuration> <generator> <database> <comments> <comment> <!-- Regular expression matching all objects that have this comment. --> <expression>CONFIGURED_COMMENT_TABLE</expression> <!-- Whether the comment is a deprecation notice. Defaults to false. --> <deprecated>true</deprecated> <!-- Whether the original schema comment should be included. Defaults to true. --> <includeSchemaComment>false</includeSchemaComment> <!-- The actual comment text. Defaults to no message. --> <message>Do not use this table.</message> </comment> </comments> </database> </generator> </configuration>
有关更多详细信息,请参见配置 XSD,独立代码生成和maven 代码生成。
new org.jooq.meta.jaxb.Configuration() .withGenerator(new Generator() .withDatabase(new Database() .withComments( new CommentType() // Regular expression matching all objects that have this comment. .withExpression("CONFIGURED_COMMENT_TABLE") // Whether the comment is a deprecation notice. Defaults to false. .withDeprecated(true) // Whether the original schema comment should be included. Defaults to true. .withIncludeSchemaComment(false) // The actual comment text. Defaults to no message. .withMessage("Do not use this table.") ) ) )
import org.jooq.meta.jaxb.* configuration { generator { database { comments { comment { // Regular expression matching all objects that have this comment. expression = "CONFIGURED_COMMENT_TABLE" // Whether the comment is a deprecation notice. Defaults to false. isDeprecated = true // Whether the original schema comment should be included. Defaults to true. isIncludeSchemaComment = false // The actual comment text. Defaults to no message. message = "Do not use this table." } } } } }
有关更多详细信息,请参见配置 XSD和gradle 代码生成。
configuration { generator { database { comments { comment { // Regular expression matching all objects that have this comment. expression = "CONFIGURED_COMMENT_TABLE" // Whether the comment is a deprecation notice. Defaults to false. deprecated = true // Whether the original schema comment should be included. Defaults to true. includeSchemaComment = false // The actual comment text. Defaults to no message. message = "Do not use this table." } } } } }
有关更多详细信息,请参见配置 XSD和gradle 代码生成。
// The jOOQ-codegen-gradle plugin has been introduced in version 3.19. // Please use the official plugin instead of the third party plugin that was recommended before.
一如既往,当使用正则表达式时,它们是具有默认标志的正则表达式。
反馈
您对此页面有任何反馈吗?我们很乐意听取您的意见!