Available in versions: Dev (3.20) | Latest (3.19) | 3.18 | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11 | 3.10

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.

MatcherRule

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

Most matchers use references to MatcherRule, which is an XSD type that looks like this:

XML (standalone and maven)
Programmatic
Gradle (Kotlin)
Gradle (Groovy)
Gradle (third party)
<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 and programmatic code generation for more details.

import org.jooq.meta.jaxb.*


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 = 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.
              expression = "PREFIX_$0_SUFFIX"
            }
          }
        }
      }
    }
  }
}

See the configuration XSD and gradle code generation for more details.

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"

              // 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.

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.

In other words, a MatcherRule describes how a specific object type name (e.g. a class name representing a generated org.jooq.Schema) should be declared and referenced based on the object's input name.

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo