Available in versions: Dev (3.19) | Latest (3.18) | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11 | 3.10 | 3.9
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.
Matcher strategies
Applies to ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
Using custom matcher strategies
In the previous section, we have seen how to override generator strategies programmatically. In this chapter, we'll see how such strategies can be configured in the XML or Maven code generator configuration. Instead of specifying a strategy name, you can also specify a <matchers/>
element as such:
-
NOTE: All regular expressions that match object identifiers try to match identifiers first by unqualified name (
org.jooq.meta.Definition.getName()
), then by qualified name (org.jooq.meta.Definition.getQualifiedName()
). - NOTE: There had been an incompatible change between jOOQ 3.2 and jOOQ 3.3 in the configuration of these matcher strategies. See #3217 for details.
<configuration> <!-- These properties can be added directly to the generator element: --> <generator> <strategy> <matchers> <!-- Specify 0..n catalog matchers to provide a strategy for naming objects created from catalogs. --> <catalogs> <catalog> <!-- Match unqualified or qualified catalog names. If left empty, this matcher applies to all catalogs. --> <expression>MY_CATALOG</expression> <!-- These elements influence the naming of a generated org.jooq.Catalog object. --> <catalogClass> see below MatcherRule specification </catalogClass> <catalogIdentifier> see below MatcherRule specification </catalogIdentifier> <catalogExtends>com.example.MyOptionalCatalogBaseType</catalogExtends> <catalogImplements>com.example.MyOptionalCustomInterface</catalogImplements> </catalog> </catalogs> <!-- Specify 0..n schema matchers to provide a strategy for naming objects created from schemas. --> <schemas> <schema> <!-- Match unqualified or qualified schema names. If left empty, this matcher applies to all schemas. --> <expression>MY_SCHEMA</expression> <!-- These elements influence the naming of a generated org.jooq.Schema object. --> <schemaClass> see below MatcherRule specification </schemaClass> <schemaIdentifier> see below MatcherRule specification </schemaIdentifier> <schemaExtends>com.example.MyOptionalSchemaBaseType</schemaExtends> <schemaImplements>com.example.MyOptionalCustomInterface</schemaImplements> </schema> </schemas> <!-- Specify 0..n table matchers to provide a strategy for naming objects created from tables. --> <tables> <table> <!-- Match unqualified or qualified table names. If left empty, this matcher applies to all tables. --> <expression>MY_TABLE</expression> <!-- These elements influence the naming of a generated org.jooq.Table object. --> <tableClass> see below MatcherRule specification </tableClass> <tableIdentifier> see below MatcherRule specification </tableIdentifier> <tableExtends>com.example.MyOptionalTableBaseType</tableExtends> <tableImplements>com.example.MyOptionalCustomInterface</tableImplements> <!-- These elements influence the naming of a generated org.jooq.Record object. --> <recordClass> see below MatcherRule specification </recordClass> <recordExtends>com.example.MyOptionalRecordBaseType</recordExtends> <recordImplements>com.example.MyOptionalCustomInterface</recordImplements> <!-- These elements influence the naming of a generated interface, implemented by generated org.jooq.Record objects and by generated POJOs. --> <interfaceClass> see below MatcherRule specification </interfaceClass> <interfaceImplements>com.example.MyOptionalCustomInterface</interfaceImplements> <!-- These elements influence the naming of a generated org.jooq.DAO object. --> <daoClass> see below MatcherRule specification </daoClass> <daoExtends>com.example.MyOptionalDAOBaseType</daoExtends> <daoImplements>com.example.MyOptionalCustomInterface</daoImplements> <!-- These elements influence the naming of a generated POJO object. --> <pojoClass> see below MatcherRule specification </pojoClass> <pojoExtends>com.example.MyOptionalPojoBaseClass</pojoExtends> <pojoImplements>com.example.MyOptionalCustomInterface</pojoImplements> </table> </tables> <!-- Specify 0..n foreign key matchers to provide a strategy for naming objects created from foreign keys. --> <foreignKeys> <foreignKey> <!-- Match unqualified or qualified foreign key names. If left empty, this matcher applies to all foreign keys. --> <expression>MY_FK_NAME</expression> <!-- The method name generated for to-one path joins. --> <methodName> see below MatcherRule specification </methodName> <!-- The method name generated for to-many path joins. --> <methodNameInverse> see below MatcherRule specification </methodNameInverse> <!-- The method name generated for many-to-many path joins. --> <methodNameManyToMany> see below MatcherRule specification </methodNameManyToMany> </foreignKey> </foreignKeys> <!-- Specify 0..n field matchers to provide a strategy for naming objects created from fields. --> <fields> <field> <!-- Match unqualified or qualified field names. If left empty, this matcher applies to all fields. --> <expression>MY_FIELD</expression> <!-- These elements influence the naming of a generated org.jooq.Field object. --> <fieldIdentifier> see below MatcherRule specification </fieldIdentifier> <fieldMember> see below MatcherRule specification </fieldMember> <fieldSetter> see below MatcherRule specification </fieldSetter> <fieldGetter> see below MatcherRule specification </fieldGetter> </field> </fields> <!-- Specify 0..n routine matchers to provide a strategy for naming objects created from routines. --> <routines> <routine> <!-- Match unqualified or qualified routine names. If left empty, this matcher applies to all routines. --> <expression>MY_ROUTINE</expression> <!-- These elements influence the naming of a generated org.jooq.Routine object. --> <routineClass> see below MatcherRule specification </routineClass> <routineMethod> see below MatcherRule specification </routineMethod> <routineExtends>com.example.MyOptionalRoutineBaseType</routineExtends> <routineImplements>com.example.MyOptionalCustomInterface</routineImplements> </routine> </routines> <!-- Specify 0..n sequence matchers to provide a strategy for naming objects created from sequences. --> <sequences> <sequence> <!-- Match unqualified or qualified sequence names. If left empty, this matcher applies to all sequences. --> <expression>MY_SEQUENCE</expression> <!-- These elements influence the naming of the generated Sequences class. --> <sequenceIdentifier> see below MatcherRule specification </sequenceIdentifier> </sequence> </sequences> <!-- Specify 0..n enum matchers to provide a strategy for naming objects created from enums. --> <enums> <enum> <!-- Match unqualified or qualified enum names. If left empty, this matcher applies to all enums. --> <expression>MY_ENUM</expression> <!-- These elements influence the naming of a generated org.jooq.EnumType object. --> <enumClass> see below MatcherRule specification </enumClass> <enumImplements>com.example.MyOptionalCustomInterface</enumImplements> <enumLiteral> see below MatcherRule specification </enumLiteral> </enum> </enums> <!-- Specify 0..n embeddable matchers to provide a strategy for naming objects created from embeddables. --> <embeddables> <embeddable> <!-- Match unqualified or qualified embeddable names. If left empty, this matcher applies to all embeddables. --> <expression>MY_EMBEDDABLE</expression> <!-- These elements influence the naming of a generated org.jooq.EmbeddableRecord object. --> <recordClass> see below MatcherRule specification </recordClass> <recordExtends>com.example.MyOptionalRoutineBaseType</recordExtends> <recordImplements>com.example.MyOptionalCustomInterface</recordImplements> <!-- These elements influence the naming of a generated interface, implemented by generated org.jooq.EmbeddableRecord objects and by generated POJOs. --> <interfaceClass> see below MatcherRule specification </interfaceClass> <interfaceImplements>com.example.MyOptionalCustomInterface</interfaceImplements> <!-- These elements influence the naming of a generated POJO object. --> <pojoClass> see below MatcherRule specification </pojoClass> <pojoExtends>com.example.MyOptionalCustomBaseClass</pojoExtends> <pojoImplements>com.example.MyOptionalCustomInterface</pojoImplements> </embeddable> </embeddables> </matchers> </strategy> </generator> </configuration>
See the configuration XSD, standalone code generation, and maven code generation for more details.
new org.jooq.meta.jaxb.Configuration() // These properties can be added directly to the generator element: .withGenerator(new Generator() .withStrategy(new Strategy() .withMatchers(new Matchers() // Specify 0..n catalog matchers to provide a strategy for naming objects created from catalogs. .withCatalogs( new MatchersCatalogType() // Match unqualified or qualified catalog names. If left empty, this matcher applies to all catalogs. .withExpression("MY_CATALOG") // These elements influence the naming of a generated org.jooq.Catalog object. .withCatalogClass(MatcherRule. see below MatcherRule specification ) .withCatalogIdentifier(MatcherRule. see below MatcherRule specification ) .withCatalogExtends("com.example.MyOptionalCatalogBaseType") .withCatalogImplements("com.example.MyOptionalCustomInterface") ) // Specify 0..n schema matchers to provide a strategy for naming objects created from schemas. .withSchemas( new MatchersSchemaType() // Match unqualified or qualified schema names. If left empty, this matcher applies to all schemas. .withExpression("MY_SCHEMA") // These elements influence the naming of a generated org.jooq.Schema object. .withSchemaClass(MatcherRule. see below MatcherRule specification ) .withSchemaIdentifier(MatcherRule. see below MatcherRule specification ) .withSchemaExtends("com.example.MyOptionalSchemaBaseType") .withSchemaImplements("com.example.MyOptionalCustomInterface") ) // Specify 0..n table matchers to provide a strategy for naming objects created from tables. .withTables( new MatchersTableType() // Match unqualified or qualified table names. If left empty, this matcher applies to all tables. .withExpression("MY_TABLE") // These elements influence the naming of a generated org.jooq.Table object. .withTableClass(MatcherRule. see below MatcherRule specification ) .withTableIdentifier(MatcherRule. see below MatcherRule specification ) .withTableExtends("com.example.MyOptionalTableBaseType") .withTableImplements("com.example.MyOptionalCustomInterface") // These elements influence the naming of a generated org.jooq.Record object. .withRecordClass(MatcherRule. see below MatcherRule specification ) .withRecordExtends("com.example.MyOptionalRecordBaseType") .withRecordImplements("com.example.MyOptionalCustomInterface") // These elements influence the naming of a generated interface, implemented by // generated org.jooq.Record objects and by generated POJOs. .withInterfaceClass(MatcherRule. see below MatcherRule specification ) .withInterfaceImplements("com.example.MyOptionalCustomInterface") // These elements influence the naming of a generated org.jooq.DAO object. .withDaoClass(MatcherRule. see below MatcherRule specification ) .withDaoExtends("com.example.MyOptionalDAOBaseType") .withDaoImplements("com.example.MyOptionalCustomInterface") // These elements influence the naming of a generated POJO object. .withPojoClass(MatcherRule. see below MatcherRule specification ) .withPojoExtends("com.example.MyOptionalPojoBaseClass") .withPojoImplements("com.example.MyOptionalCustomInterface") ) // Specify 0..n foreign key matchers to provide a strategy for naming objects created from foreign keys. .withForeignKeys( new UnknownType() // Match unqualified or qualified foreign key names. If left empty, this matcher applies to all foreign keys. .withExpression("MY_FK_NAME") // The method name generated for to-one path joins. .withMethodName(" see below MatcherRule specification ") // The method name generated for to-many path joins. .withMethodNameInverse(" see below MatcherRule specification ") // The method name generated for many-to-many path joins. .withMethodNameManyToMany(" see below MatcherRule specification ") ) // Specify 0..n field matchers to provide a strategy for naming objects created from fields. .withFields( new MatchersFieldType() // Match unqualified or qualified field names. If left empty, this matcher applies to all fields. .withExpression("MY_FIELD") // These elements influence the naming of a generated org.jooq.Field object. .withFieldIdentifier(MatcherRule. see below MatcherRule specification ) .withFieldMember(MatcherRule. see below MatcherRule specification ) .withFieldSetter(MatcherRule. see below MatcherRule specification ) .withFieldGetter(MatcherRule. see below MatcherRule specification ) ) // Specify 0..n routine matchers to provide a strategy for naming objects created from routines. .withRoutines( new MatchersRoutineType() // Match unqualified or qualified routine names. If left empty, this matcher applies to all routines. .withExpression("MY_ROUTINE") // These elements influence the naming of a generated org.jooq.Routine object. .withRoutineClass(MatcherRule. see below MatcherRule specification ) .withRoutineMethod(MatcherRule. see below MatcherRule specification ) .withRoutineExtends("com.example.MyOptionalRoutineBaseType") .withRoutineImplements("com.example.MyOptionalCustomInterface") ) // Specify 0..n sequence matchers to provide a strategy for naming objects created from sequences. .withSequences( new MatchersSequenceType() // Match unqualified or qualified sequence names. If left empty, this matcher applies to all sequences. .withExpression("MY_SEQUENCE") // These elements influence the naming of the generated Sequences class. .withSequenceIdentifier(MatcherRule. see below MatcherRule specification ) ) // Specify 0..n enum matchers to provide a strategy for naming objects created from enums. .withEnums( new MatchersEnumType() // Match unqualified or qualified enum names. If left empty, this matcher applies to all enums. .withExpression("MY_ENUM") // These elements influence the naming of a generated org.jooq.EnumType object. .withEnumClass(MatcherRule. see below MatcherRule specification ) .withEnumImplements("com.example.MyOptionalCustomInterface") .withEnumLiteral(MatcherRule. see below MatcherRule specification ) ) // Specify 0..n embeddable matchers to provide a strategy for naming objects created from embeddables. .withEmbeddables( new MatchersEmbeddableType() // Match unqualified or qualified embeddable names. If left empty, this matcher applies to all embeddables. .withExpression("MY_EMBEDDABLE") // These elements influence the naming of a generated org.jooq.EmbeddableRecord object. .withRecordClass(MatcherRule. see below MatcherRule specification ) .withRecordExtends("com.example.MyOptionalRoutineBaseType") .withRecordImplements("com.example.MyOptionalCustomInterface") // These elements influence the naming of a generated interface, implemented by // generated org.jooq.EmbeddableRecord objects and by generated POJOs. .withInterfaceClass(MatcherRule. see below MatcherRule specification ) .withInterfaceImplements("com.example.MyOptionalCustomInterface") // These elements influence the naming of a generated POJO object. .withPojoClass(MatcherRule. see below MatcherRule specification ) .withPojoExtends("com.example.MyOptionalCustomBaseClass") .withPojoImplements("com.example.MyOptionalCustomInterface") ) ) ) )
See the configuration XSD andprogrammatic code generation for more details.
generationTool { // These properties can be added directly to the generator element: generator { strategy { matchers { // Specify 0..n catalog matchers to provide a strategy for naming objects created from catalogs. catalogs { catalog { // Match unqualified or qualified catalog names. If left empty, this matcher applies to all catalogs. expression = 'MY_CATALOG' // These elements influence the naming of a generated org.jooq.Catalog object. catalogClass = ' see below MatcherRule specification ' catalogIdentifier = ' see below MatcherRule specification ' catalogExtends = 'com.example.MyOptionalCatalogBaseType' catalogImplements = 'com.example.MyOptionalCustomInterface' } } // Specify 0..n schema matchers to provide a strategy for naming objects created from schemas. schemas { schema { // Match unqualified or qualified schema names. If left empty, this matcher applies to all schemas. expression = 'MY_SCHEMA' // These elements influence the naming of a generated org.jooq.Schema object. schemaClass = ' see below MatcherRule specification ' schemaIdentifier = ' see below MatcherRule specification ' schemaExtends = 'com.example.MyOptionalSchemaBaseType' schemaImplements = 'com.example.MyOptionalCustomInterface' } } // Specify 0..n table matchers to provide a strategy for naming objects created from tables. tables { table { // Match unqualified or qualified table names. If left empty, this matcher applies to all tables. expression = 'MY_TABLE' // These elements influence the naming of a generated org.jooq.Table object. tableClass = ' see below MatcherRule specification ' tableIdentifier = ' see below MatcherRule specification ' tableExtends = 'com.example.MyOptionalTableBaseType' tableImplements = 'com.example.MyOptionalCustomInterface' // These elements influence the naming of a generated org.jooq.Record object. recordClass = ' see below MatcherRule specification ' recordExtends = 'com.example.MyOptionalRecordBaseType' recordImplements = 'com.example.MyOptionalCustomInterface' // These elements influence the naming of a generated interface, implemented by // generated org.jooq.Record objects and by generated POJOs. interfaceClass = ' see below MatcherRule specification ' interfaceImplements = 'com.example.MyOptionalCustomInterface' // These elements influence the naming of a generated org.jooq.DAO object. daoClass = ' see below MatcherRule specification ' daoExtends = 'com.example.MyOptionalDAOBaseType' daoImplements = 'com.example.MyOptionalCustomInterface' // These elements influence the naming of a generated POJO object. pojoClass = ' see below MatcherRule specification ' pojoExtends = 'com.example.MyOptionalPojoBaseClass' pojoImplements = 'com.example.MyOptionalCustomInterface' } } // Specify 0..n foreign key matchers to provide a strategy for naming objects created from foreign keys. foreignKeys { foreignKey { // Match unqualified or qualified foreign key names. If left empty, this matcher applies to all foreign keys. expression = 'MY_FK_NAME' // The method name generated for to-one path joins. methodName = ' see below MatcherRule specification ' // The method name generated for to-many path joins. methodNameInverse = ' see below MatcherRule specification ' // The method name generated for many-to-many path joins. methodNameManyToMany = ' see below MatcherRule specification ' } } // Specify 0..n field matchers to provide a strategy for naming objects created from fields. fields { field { // Match unqualified or qualified field names. If left empty, this matcher applies to all fields. expression = 'MY_FIELD' // These elements influence the naming of a generated org.jooq.Field object. fieldIdentifier = ' see below MatcherRule specification ' fieldMember = ' see below MatcherRule specification ' fieldSetter = ' see below MatcherRule specification ' fieldGetter = ' see below MatcherRule specification ' } } // Specify 0..n routine matchers to provide a strategy for naming objects created from routines. routines { routine { // Match unqualified or qualified routine names. If left empty, this matcher applies to all routines. expression = 'MY_ROUTINE' // These elements influence the naming of a generated org.jooq.Routine object. routineClass = ' see below MatcherRule specification ' routineMethod = ' see below MatcherRule specification ' routineExtends = 'com.example.MyOptionalRoutineBaseType' routineImplements = 'com.example.MyOptionalCustomInterface' } } // Specify 0..n sequence matchers to provide a strategy for naming objects created from sequences. sequences { sequence { // Match unqualified or qualified sequence names. If left empty, this matcher applies to all sequences. expression = 'MY_SEQUENCE' // These elements influence the naming of the generated Sequences class. sequenceIdentifier = ' see below MatcherRule specification ' } } // Specify 0..n enum matchers to provide a strategy for naming objects created from enums. enums { enum { // Match unqualified or qualified enum names. If left empty, this matcher applies to all enums. expression = 'MY_ENUM' // These elements influence the naming of a generated org.jooq.EnumType object. enumClass = ' see below MatcherRule specification ' enumImplements = 'com.example.MyOptionalCustomInterface' enumLiteral = ' see below MatcherRule specification ' } } // Specify 0..n embeddable matchers to provide a strategy for naming objects created from embeddables. embeddables { embeddable { // Match unqualified or qualified embeddable names. If left empty, this matcher applies to all embeddables. expression = 'MY_EMBEDDABLE' // These elements influence the naming of a generated org.jooq.EmbeddableRecord object. recordClass = ' see below MatcherRule specification ' recordExtends = 'com.example.MyOptionalRoutineBaseType' recordImplements = 'com.example.MyOptionalCustomInterface' // These elements influence the naming of a generated interface, implemented by // generated org.jooq.EmbeddableRecord objects and by generated POJOs. interfaceClass = ' see below MatcherRule specification ' interfaceImplements = 'com.example.MyOptionalCustomInterface' // These elements influence the naming of a generated POJO object. pojoClass = ' see below MatcherRule specification ' pojoExtends = 'com.example.MyOptionalCustomBaseClass' pojoImplements = 'com.example.MyOptionalCustomInterface' } } } } } }
See the configuration XSD and gradle code generation for more details.
As always, when regular expressions are used, they are regular expressions with default flags.
When using anyrecordExtends
,tableExtends
, etc. setting, you must make sure to correctly implement the internal jOOQ APIs, which are not documented here for they are internal. In particular, if you're extendingorg.jooq.impl.TableImpl
, for example, your custom base class may break between minor versions of jOOQ, as new constructors are added.
The above example used references to "MatcherRule", which is an XSD type that looks like this:
<configuration> <generator> <strategy> <matchers> <schemas> <schema> <schemaClass> <!-- The optional transform element lets you apply a name transformation algorithm to transform the actual database name into a more convenient form. Possible values are: - AS_IS : Leave the database name as it is : MY_name => MY_name - LOWER : Transform the database name into lower case : MY_name => my_name - LOWER_FIRST_LETTER : Transform the first letter into lower case : MY_name => mY_name - UPPER : Transform the database name into upper case : MY_name => MY_NAME - UPPER_FIRST_LETTER : Transform the first letter into upper case : my_NAME => My_NAME - CAMEL : Transform the database name into camel case : MY_name => myName - PASCAL : Transform the database name into pascal case : MY_name => MyName --> <transform>CAMEL</transform> <!-- The mandatory expression element lets you specify a replacement expression to be used when replacing the matcher's regular expression. You can use indexed variables $0, $1, $2. --> <expression>PREFIX_$0_SUFFIX</expression> </schemaClass> </schema> </schemas> </matchers> </strategy> </generator> </configuration>
See the configuration XSD, standalone code generation, and maven code generation for more details.
new org.jooq.meta.jaxb.Configuration() .withGenerator(new Generator() .withStrategy(new Strategy() .withMatchers(new Matchers() .withSchemas( new MatchersSchemaType() .withSchemaClass(new MatcherRule() // The optional transform element lets you apply a name transformation algorithm // to transform the actual database name into a more convenient form. Possible values are: // // - AS_IS : Leave the database name as it is : MY_name => MY_name // - LOWER : Transform the database name into lower case : MY_name => my_name // - LOWER_FIRST_LETTER : Transform the first letter into lower case : MY_name => mY_name // - UPPER : Transform the database name into upper case : MY_name => MY_NAME // - UPPER_FIRST_LETTER : Transform the first letter into upper case : my_NAME => My_NAME // - CAMEL : Transform the database name into camel case : MY_name => myName // - PASCAL : Transform the database name into pascal case : MY_name => MyName .withTransform(MatcherTransformType.CAMEL) // The mandatory expression element lets you specify a replacement expression to be used when // replacing the matcher's regular expression. You can use indexed variables $0, $1, $2. .withExpression("PREFIX_$0_SUFFIX") ) ) ) ) )
See the configuration XSD andprogrammatic code generation for more details.
generationTool { generator { strategy { matchers { schemas { schema { schemaClass { // The optional transform element lets you apply a name transformation algorithm // to transform the actual database name into a more convenient form. Possible values are: // // - AS_IS : Leave the database name as it is : MY_name => MY_name // - LOWER : Transform the database name into lower case : MY_name => my_name // - LOWER_FIRST_LETTER : Transform the first letter into lower case : MY_name => mY_name // - UPPER : Transform the database name into upper case : MY_name => MY_NAME // - UPPER_FIRST_LETTER : Transform the first letter into upper case : my_NAME => My_NAME // - CAMEL : Transform the database name into camel case : MY_name => myName // - PASCAL : Transform the database name into pascal case : MY_name => MyName transform = 'CAMEL' // The mandatory expression element lets you specify a replacement expression to be used when // replacing the matcher's regular expression. You can use indexed variables $0, $1, $2. expression = 'PREFIX_$0_SUFFIX' } } } } } } }
See the configuration XSD and gradle code generation for more details.
As always, when regular expressions are used, they are regular expressions with default flags.
Some examples
The following example shows a matcher strategy that adds a "T_"
prefix to all table classes and to table identifiers:
<configuration> <generator> <strategy> <matchers> <tables> <table> <!-- Expression is omitted. This will make this rule apply to all tables --> <tableIdentifier> <transform>UPPER</transform> <expression>T_$0</expression> </tableIdentifier> <tableClass> <transform>PASCAL</transform> <expression>T_$0</expression> </tableClass> </table> </tables> </matchers> </strategy> </generator> </configuration>
See the configuration XSD, standalone code generation, and maven code generation for more details.
new org.jooq.meta.jaxb.Configuration() .withGenerator(new Generator() .withStrategy(new Strategy() .withMatchers(new Matchers() .withTables( new MatchersTableType() // Expression is omitted. This will make this rule apply to all tables .withTableIdentifier(new MatcherRule() .withTransform(MatcherTransformType.UPPER) .withExpression("T_$0") ) .withTableClass(new MatcherRule() .withTransform(MatcherTransformType.PASCAL) .withExpression("T_$0") ) ) ) ) )
See the configuration XSD andprogrammatic code generation for more details.
generationTool { generator { strategy { matchers { tables { table { // Expression is omitted. This will make this rule apply to all tables tableIdentifier { transform = 'UPPER' expression = 'T_$0' } tableClass { transform = 'PASCAL' expression = 'T_$0' } } } } } } }
See the configuration XSD and gradle code generation for more details.
As always, when regular expressions are used, they are regular expressions with default flags.
The following example shows a matcher strategy that renames BOOK table identifiers (or table identifiers containing BOOK) into BROCHURE (or tables containing BROCHURE):
<configuration> <generator> <strategy> <matchers> <tables> <table> <expression>^(.*?)_BOOK_(.*)$</expression> <tableIdentifier> <transform>UPPER</transform> <expression>$1_BROCHURE_$2</expression> </tableIdentifier> </table> </tables> </matchers> </strategy> </generator> </configuration>
See the configuration XSD, standalone code generation, and maven code generation for more details.
new org.jooq.meta.jaxb.Configuration() .withGenerator(new Generator() .withStrategy(new Strategy() .withMatchers(new Matchers() .withTables( new MatchersTableType() .withExpression("^(.*?)_BOOK_(.*)$") .withTableIdentifier(new MatcherRule() .withTransform(MatcherTransformType.UPPER) .withExpression("$1_BROCHURE_$2") ) ) ) ) )
See the configuration XSD andprogrammatic code generation for more details.
generationTool { generator { strategy { matchers { tables { table { expression = '^(.*?)_BOOK_(.*)$' tableIdentifier { transform = 'UPPER' expression = '$1_BROCHURE_$2' } } } } } } }
See the configuration XSD and gradle code generation for more details.
As always, when regular expressions are used, they are regular expressions with default flags.
For more information about each XML tag, please refer to the https://www.jooq.org/xsd/jooq-codegen-3.18.0.xsd XSD file.
Feedback
Do you have any feedback about this page? We'd love to hear it!