匹配目录
适用于 ✅ 开源版 ✅ 专业版 ✅ 企业版
以下示例展示了如何为生成的 org.jooq.Catalog
类型和相关对象定义 MatcherStrategy
XML(独立和 Maven)
编程方式
Gradle (Kotlin)
Gradle (Groovy)
Gradle(第三方)
<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> a MatcherRule specification </catalogClass> <catalogIdentifier> a MatcherRule specification </catalogIdentifier> <catalogExtends>com.example.MyOptionalCatalogBaseType</catalogExtends> <catalogImplements>com.example.MyOptionalCustomInterface</catalogImplements> </catalog> </catalogs> </matchers> </strategy> </generator> </configuration>
有关更多详细信息,请参阅配置 XSD、独立代码生成和Maven 代码生成。
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. a MatcherRule specification ) .withCatalogIdentifier(MatcherRule. a MatcherRule specification ) .withCatalogExtends("com.example.MyOptionalCatalogBaseType") .withCatalogImplements("com.example.MyOptionalCustomInterface") ) ) ) )
import org.jooq.meta.jaxb.* 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" // These elements influence the naming of a generated org.jooq.Catalog object. catalogClass = MatcherRule. a MatcherRule specification catalogIdentifier = MatcherRule. a MatcherRule specification catalogExtends = "com.example.MyOptionalCatalogBaseType" catalogImplements = "com.example.MyOptionalCustomInterface" } } } } } }
有关更多详细信息,请参阅配置 XSD和Gradle 代码生成。
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" // These elements influence the naming of a generated org.jooq.Catalog object. catalogClass = " a MatcherRule specification " catalogIdentifier = " a MatcherRule specification " catalogExtends = "com.example.MyOptionalCatalogBaseType" catalogImplements = "com.example.MyOptionalCustomInterface" } } } } } }
有关更多详细信息,请参阅配置 XSD和Gradle 代码生成。
// The jOOQ-codegen-gradle plugin has been introduced in version 3.19. // Please use the official plugin instead of the third party plugin that was recommended before.
一如既往,当使用正则表达式时,它们是具有默认标志的正则表达式。
当使用任何catalogExtends
等设置时,您必须确保正确实现内部 jOOQ API,这些 API 在此未被记录,因为它们是内部的。 特别是,如果您要扩展org.jooq.impl.TableImpl
,例如,您的自定义基类可能会在 jOOQ 的次要版本之间中断,因为会添加新的构造函数。
有关 MatcherRule
规范的更多信息,请参见MatcherRule。
反馈
您对此页面有任何反馈吗? 我们很乐意听取您的意见!