The jOOQ User Manual : Code generation : Advanced generator configuration : Database : Comments | previous : next |
This documentation is for the unreleased development version of jOOQ. Click on the above version links to get this documentation for a supported version of jOOQ.
Comments
Applies to ❌ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
jOOQ's code generator will pick up comments on schema objects created with the COMMENT statement and generate Javadocs accordingly.
If your dialect does not support the COMMENT
statement, or your schema doesn't have comments, or you want to amend / replace the schema comments in the code generator, this section will show you how to add "synthetic" comments to your schema objects.
<configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.16.5.xsd"> <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>
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.") ) ) )
myConfigurationName(sourceSets.main) { 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.' } } } } }
As always, when regular expressions are used, they are regular expressions with default flags.
Feedback
Do you have any feedback about this page? We'd love to hear it!