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.
Matching embeddables
Applies to ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
The following example shows how to define a MatcherStrategy for generated org.jooq.EmbeddableRecord
types and related objects:
<configuration> <!-- These properties can be added directly to the generator element: --> <generator> <strategy> <matchers> <!-- 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> a 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> a MatcherRule specification </interfaceClass> <interfaceImplements>com.example.MyOptionalCustomInterface</interfaceImplements> <!-- These elements influence the naming of a generated POJO object. --> <pojoClass> a 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 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. a 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. a MatcherRule specification ) .withInterfaceImplements("com.example.MyOptionalCustomInterface") // These elements influence the naming of a generated POJO object. .withPojoClass(MatcherRule. a MatcherRule specification ) .withPojoExtends("com.example.MyOptionalCustomBaseClass") .withPojoImplements("com.example.MyOptionalCustomInterface") ) ) ) )
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 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 = MatcherRule. a 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 = MatcherRule. a MatcherRule specification interfaceImplements = "com.example.MyOptionalCustomInterface" // These elements influence the naming of a generated POJO object. pojoClass = MatcherRule. a MatcherRule specification pojoExtends = "com.example.MyOptionalCustomBaseClass" pojoImplements = "com.example.MyOptionalCustomInterface" } } } } } }
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 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 = " a 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 = " a MatcherRule specification " interfaceImplements = "com.example.MyOptionalCustomInterface" // These elements influence the naming of a generated POJO object. pojoClass = " a MatcherRule specification " pojoExtends = "com.example.MyOptionalCustomBaseClass" pojoImplements = "com.example.MyOptionalCustomInterface" } } } } } }
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 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 = " a 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 = " a MatcherRule specification " interfaceImplements = "com.example.MyOptionalCustomInterface" // These elements influence the naming of a generated POJO object. pojoClass = " a 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
, 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.
See MatcherRule for more information about MatcherRule
specifications.
Feedback
Do you have any feedback about this page? We'd love to hear it!