Available in versions: Dev (3.20) | Latest (3.19)

Matching attributes

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

The following example shows how to define a MatcherStrategy for generated org.jooq.UDTField types and related objects:

XML (standalone and maven)
Programmatic
Gradle (Kotlin)
Gradle (Groovy)
Gradle (third party)
<configuration>
  <!-- These properties can be added directly to the generator element: -->
  <generator>
    <strategy>
      <matchers>

        <!-- Specify 0..n UDT attribute matchers to provide a strategy for naming objects created from UDT attributes. -->
        <attributes>
          <attribute>

            <!-- Match unqualified or qualified UDT attribute names. If left empty, this matcher applies to all UDT attributes. -->
            <expression>MY_FIELD</expression>

            <!-- These elements influence the naming of a generated org.jooq.UDTField object. -->
            <fieldIdentifier> a MatcherRule specification </fieldIdentifier>
            <fieldMember> a MatcherRule specification </fieldMember>
            <fieldSetter> a MatcherRule specification </fieldSetter>
            <fieldGetter> a MatcherRule specification </fieldGetter>
            
          </attribute>
        </attributes>
      </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 UDT attribute matchers to provide a strategy for naming objects created from UDT attributes.
        .withAttributes(
          new MatchersAttributeType()

            // Match unqualified or qualified UDT attribute names. If left empty, this matcher applies to all UDT attributes.
            .withExpression("MY_FIELD")

            // These elements influence the naming of a generated org.jooq.UDTField object.
            .withFieldIdentifier(" a MatcherRule specification ")
            .withFieldMember(" a MatcherRule specification ")
            .withFieldSetter(" a MatcherRule specification ")
            .withFieldGetter(" a MatcherRule specification ")
        )
      )
    )
  )

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

import org.jooq.meta.jaxb.*


configuration {

  // These properties can be added directly to the generator element:
  generator {
    strategy {
      matchers {

        // Specify 0..n UDT attribute matchers to provide a strategy for naming objects created from UDT attributes.
        attributes {
          attribute {

            // Match unqualified or qualified UDT attribute names. If left empty, this matcher applies to all UDT attributes.
            expression = "MY_FIELD"

            // These elements influence the naming of a generated org.jooq.UDTField object.
            fieldIdentifier = " a MatcherRule specification "
            fieldMember = " a MatcherRule specification "
            fieldSetter = " a MatcherRule specification "
            fieldGetter = " a MatcherRule specification "
          }
        }
      }
    }
  }
}

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

configuration {

  // These properties can be added directly to the generator element:
  generator {
    strategy {
      matchers {

        // Specify 0..n UDT attribute matchers to provide a strategy for naming objects created from UDT attributes.
        attributes {
          attribute {

            // Match unqualified or qualified UDT attribute names. If left empty, this matcher applies to all UDT attributes.
            expression = "MY_FIELD"

            // These elements influence the naming of a generated org.jooq.UDTField object.
            fieldIdentifier = " a MatcherRule specification "
            fieldMember = " a MatcherRule specification "
            fieldSetter = " a MatcherRule specification "
            fieldGetter = " a MatcherRule specification "
          }
        }
      }
    }
  }
}

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

generationTool {

  // These properties can be added directly to the generator element:
  generator {
    strategy {
      matchers {

        // Specify 0..n UDT attribute matchers to provide a strategy for naming objects created from UDT attributes.
        attributes {
          attribute {

            // Match unqualified or qualified UDT attribute names. If left empty, this matcher applies to all UDT attributes.
            expression = "MY_FIELD"

            // These elements influence the naming of a generated org.jooq.UDTField object.
            fieldIdentifier = " a MatcherRule specification "
            fieldMember = " a MatcherRule specification "
            fieldSetter = " a MatcherRule specification "
            fieldGetter = " a MatcherRule specification "
          }
        }
      }
    }
  }
}

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.

See MatcherRule for more information about MatcherRule specifications.

Feedback

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

The jOOQ Logo