[jOOQ/jOOQ#9844] Generator strategies should support <schemaExtends/>, <tableExtends/>, <recordExtends/>, <daoExtends/>, <routineExtends/>

This commit is contained in:
Lukas Eder 2022-07-07 16:01:22 +02:00
parent 47503f68bf
commit 479c0e06e4
10 changed files with 475 additions and 31 deletions

View File

@ -10,6 +10,7 @@ module org.jooq.codegen {
// - Settings (org.jooq.conf)
// - InformationSchema (org.jooq.util.xml.jaxb)
requires static jakarta.xml.bind;
requires org.jooq;
exports org.jooq.codegen;
exports org.jooq.codegen.example;

View File

@ -58,6 +58,16 @@ import java.util.List;
import java.util.Locale;
// ...
import org.jooq.impl.AbstractRoutine;
import org.jooq.impl.CatalogImpl;
import org.jooq.impl.DAOImpl;
import org.jooq.impl.EmbeddableRecordImpl;
import org.jooq.impl.SchemaImpl;
import org.jooq.impl.TableImpl;
import org.jooq.impl.TableRecordImpl;
import org.jooq.impl.UDTImpl;
import org.jooq.impl.UDTRecordImpl;
import org.jooq.impl.UpdatableRecordImpl;
import org.jooq.meta.ArrayDefinition;
import org.jooq.meta.CatalogDefinition;
import org.jooq.meta.ColumnDefinition;
@ -291,6 +301,34 @@ public class DefaultGeneratorStrategy extends AbstractGeneratorStrategy {
@Override
public String getJavaClassExtends(Definition definition, Mode mode) {
if (definition instanceof CatalogDefinition) {
return CatalogImpl.class.getName();
}
else if (definition instanceof SchemaDefinition) {
return SchemaImpl.class.getName();
}
else if (definition instanceof RoutineDefinition) {
return AbstractRoutine.class.getName();
}
else if (definition instanceof TableDefinition t) {
switch (mode) {
case DAO: return DAOImpl.class.getName();
case RECORD: return (t.getPrimaryKey() != null ? UpdatableRecordImpl.class : TableRecordImpl.class).getName();
case DEFAULT: return TableImpl.class.getName();
}
}
else if (definition instanceof UDTDefinition) {
switch (mode) {
case RECORD: return UDTRecordImpl.class.getName();
case DEFAULT: return UDTImpl.class.getName();
}
}
else if (definition instanceof EmbeddableDefinition) {
switch (mode) {
case RECORD: return EmbeddableRecordImpl.class.getName();
}
}
return null;
}

View File

@ -96,7 +96,6 @@ import java.util.stream.Stream;
import org.jooq.AggregateFunction;
import org.jooq.Catalog;
import org.jooq.Check;
import org.jooq.Condition;
import org.jooq.Configuration;
import org.jooq.Constants;
import org.jooq.DSLContext;
@ -118,7 +117,6 @@ import org.jooq.Query;
import org.jooq.Record;
import org.jooq.Records;
import org.jooq.Result;
import org.jooq.ResultQuery;
import org.jooq.Row;
import org.jooq.RowId;
import org.jooq.SQLDialect;
@ -129,7 +127,6 @@ import org.jooq.Sequence;
import org.jooq.SortOrder;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableLike;
import org.jooq.TableOptions;
import org.jooq.UDT;
import org.jooq.UDTField;
@ -140,14 +137,11 @@ import org.jooq.codegen.GeneratorWriter.CloseResult;
import org.jooq.conf.ParseSearchSchema;
import org.jooq.conf.ParseWithMetaLookups;
import org.jooq.exception.SQLDialectNotSupportedException;
import org.jooq.impl.AbstractRoutine;
// ...
// ...
import org.jooq.impl.CatalogImpl;
import org.jooq.impl.DAOImpl;
import org.jooq.impl.DSL;
import org.jooq.impl.DefaultDataType;
import org.jooq.impl.EmbeddableRecordImpl;
import org.jooq.impl.Internal;
import org.jooq.impl.LazySchema;
import org.jooq.impl.LazySupplier;
@ -158,7 +152,6 @@ import org.jooq.impl.SchemaImpl;
import org.jooq.impl.TableImpl;
import org.jooq.impl.TableRecordImpl;
import org.jooq.impl.UDTImpl;
import org.jooq.impl.UDTRecordImpl;
import org.jooq.impl.UpdatableRecordImpl;
import org.jooq.meta.AbstractTypedElementDefinition;
import org.jooq.meta.ArrayDefinition;
@ -1514,15 +1507,12 @@ public class JavaGenerator extends AbstractGenerator {
if (tableUdtOrEmbeddable instanceof TableDefinition)
printTableJPAAnnotation(out, (TableDefinition) tableUdtOrEmbeddable);
Class<?> baseClass;
if (tableUdtOrEmbeddable instanceof UDTDefinition)
baseClass = UDTRecordImpl.class;
else if (tableUdtOrEmbeddable instanceof EmbeddableDefinition)
baseClass = EmbeddableRecordImpl.class;
else if (generateRelations() && key != null)
baseClass = UpdatableRecordImpl.class;
else
baseClass = TableRecordImpl.class;
String baseClass = out.ref(getStrategy().getJavaClassExtends(tableUdtOrEmbeddable, Mode.RECORD));
// [#9844] The GeneratorStrategy doesn't have access to the generateRelations flag,
// so restore the behaviour here in case users don't override the defaults.
if (UpdatableRecordImpl.class.getName().equals(baseClass) && !generateRelations())
baseClass = TableRecordImpl.class.getName();
// [#10481] Use the types from replaced embeddables if applicable
List<Definition> embeddablesAndColumns = embeddablesAndColumns(tableUdtOrEmbeddable);
@ -3072,6 +3062,7 @@ public class JavaGenerator extends AbstractGenerator {
final boolean synthetic = udt.isSynthetic();
final String className = getStrategy().getJavaClassName(udt);
final String recordType = out.ref(getStrategy().getFullJavaClassName(udt, Mode.RECORD));
final String classExtends = out.ref(getStrategy().getJavaClassExtends(udt, Mode.DEFAULT));
final List<String> interfaces = out.ref(getStrategy().getJavaClassImplements(udt, Mode.DEFAULT));
final String schemaId = out.ref(getStrategy().getFullJavaIdentifier(schema), 2);
final String packageId = pkg == null ? null : out.ref(getStrategy().getFullJavaIdentifier(pkg), 2);
@ -3104,10 +3095,10 @@ public class JavaGenerator extends AbstractGenerator {
if (scala) {
out.println("%sclass %s extends %s[%s](\"%s\", null, %s, %s)[[before= with ][separator= with ][%s]] {", visibility(), className, UDTImpl.class, recordType, escapeString(udt.getOutputName()), packageId, synthetic, interfaces);
out.println("%sclass %s extends %s[%s](\"%s\", null, %s, %s)[[before= with ][separator= with ][%s]] {", visibility(), className, classExtends, recordType, escapeString(udt.getOutputName()), packageId, synthetic, interfaces);
}
else if (kotlin) {
out.println("%sopen class %s : %s<%s>(\"%s\", null, %s, %s)[[before=, ][%s]] {", visibility(), className, UDTImpl.class, recordType, escapeString(udt.getOutputName()), packageId, synthetic, interfaces);
out.println("%sopen class %s : %s<%s>(\"%s\", null, %s, %s)[[before=, ][%s]] {", visibility(), className, classExtends, recordType, escapeString(udt.getOutputName()), packageId, synthetic, interfaces);
out.println();
out.println("public companion object {");
@ -3116,7 +3107,7 @@ public class JavaGenerator extends AbstractGenerator {
out.println("}");
}
else {
out.println("%sclass %s extends %s<%s>[[before= implements ][%s]] {", visibility(), className, UDTImpl.class, recordType, interfaces);
out.println("%sclass %s extends %s<%s>[[before= implements ][%s]] {", visibility(), className, classExtends, recordType, interfaces);
out.printSerial();
printSingletonInstance(out, udt);
}
@ -5891,6 +5882,7 @@ public class JavaGenerator extends AbstractGenerator {
? out.ref(getStrategy().getFullJavaIdentifier(table), 2)
: getStrategy().getJavaIdentifier(table);
final String recordType = out.ref(getStrategy().getFullJavaClassName(table, Mode.RECORD));
final String classExtends = out.ref(getStrategy().getJavaClassExtends(table, Mode.DEFAULT));
final List<String> interfaces = out.ref(getStrategy().getJavaClassImplements(table, Mode.DEFAULT));
final String schemaId = out.ref(getStrategy().getFullJavaIdentifier(schema), 2);
final String tableType = table.isTemporary()
@ -5924,7 +5916,7 @@ public class JavaGenerator extends AbstractGenerator {
out.println("aliased: %s[%s],", Table.class, recordType);
out.println("parameters: %s[ %s[_] ]", out.ref("scala.Array"), Field.class);
out.println(")");
out.println("extends %s[%s](", TableImpl.class, recordType);
out.println("extends %s[%s](", classExtends, recordType);
out.println("alias,");
out.println("%s,", schemaId);
out.println("child,");
@ -5949,7 +5941,7 @@ public class JavaGenerator extends AbstractGenerator {
out.println("path: %s<out %s, %s>?,", ForeignKey.class, Record.class, recordType);
out.println("aliased: %s<%s>?,", Table.class, recordType);
out.println("parameters: Array<%s<*>?>?", Field.class);
out.println("): %s<%s>(", TableImpl.class, recordType);
out.println("): %s<%s>(", classExtends, recordType);
out.println("alias,");
out.println("%s,", schemaId);
out.println("child,");
@ -5972,7 +5964,7 @@ public class JavaGenerator extends AbstractGenerator {
out.println("}");
}
else {
out.println("%sclass %s extends %s<%s>[[before= implements ][%s]] {", visibility(), className, TableImpl.class, recordType, interfaces);
out.println("%sclass %s extends %s<%s>[[before= implements ][%s]] {", visibility(), className, classExtends, recordType, interfaces);
out.printSerial();
printSingletonInstance(out, table);
}
@ -7383,6 +7375,7 @@ public class JavaGenerator extends AbstractGenerator {
final String catalogId = getStrategy().getJavaIdentifier(catalog);
final String catalogName = !catalog.getQualifiedOutputName().isEmpty() ? catalog.getQualifiedOutputName() : catalogId;
final String className = getStrategy().getJavaClassName(catalog);
final String classExtends = out.ref(getStrategy().getJavaClassExtends(catalog));
final List<String> interfaces = out.ref(getStrategy().getJavaClassImplements(catalog, Mode.DEFAULT));
printPackage(out, catalog);
@ -7400,11 +7393,11 @@ public class JavaGenerator extends AbstractGenerator {
if (scala) {
out.println("%sclass %s extends %s(\"%s\")[[before= with ][separator= with ][%s]] {",
visibility(), className, CatalogImpl.class, catalog.getOutputName(), interfaces);
visibility(), className, classExtends, catalog.getOutputName(), interfaces);
}
else if (kotlin) {
out.println("%sopen class %s : %s(\"%s\")[[before=, ][%s]] {",
visibility(), className, CatalogImpl.class, catalog.getOutputName(), interfaces);
visibility(), className, classExtends, catalog.getOutputName(), interfaces);
out.println("%scompanion object {", visibility());
out.javadoc("The reference instance of <code>%s</code>", catalogName);
@ -7412,7 +7405,7 @@ public class JavaGenerator extends AbstractGenerator {
out.println("}");
}
else {
out.println("%sclass %s extends %s[[before= implements ][%s]] {", visibility(), className, CatalogImpl.class, interfaces);
out.println("%sclass %s extends %s[[before= implements ][%s]] {", visibility(), className, classExtends, interfaces);
out.printSerial();
out.javadoc("The reference instance of <code>%s</code>", catalogName);
out.println("%sstatic final %s %s = new %s();", visibility(), className, catalogId, className);
@ -7509,6 +7502,7 @@ public class JavaGenerator extends AbstractGenerator {
final String schemaId = getStrategy().getJavaIdentifier(schema);
final String schemaName = !schema.getQualifiedOutputName().isEmpty() ? schema.getQualifiedOutputName() : schemaId;
final String className = getStrategy().getJavaClassName(schema);
final String classExtends = out.ref(getStrategy().getJavaClassExtends(schema));
final List<String> interfaces = out.ref(getStrategy().getJavaClassImplements(schema, Mode.DEFAULT));
printPackage(out, schema);
@ -7526,11 +7520,11 @@ public class JavaGenerator extends AbstractGenerator {
if (scala) {
out.println("%sclass %s extends %s(\"%s\", %s)[[before= with ][separator= with ][%s]] {",
visibility(), className, SchemaImpl.class, escapeString(schema.getOutputName()), catalogId, interfaces);
visibility(), className, classExtends, escapeString(schema.getOutputName()), catalogId, interfaces);
}
else if (kotlin) {
out.println("%sopen class %s : %s(\"%s\", %s)[[before=, ][%s]] {",
visibility(), className, SchemaImpl.class, escapeString(schema.getOutputName()), catalogId, interfaces);
visibility(), className, classExtends, escapeString(schema.getOutputName()), catalogId, interfaces);
out.println("public companion object {");
out.javadoc("The reference instance of <code>%s</code>", schemaName);
@ -7538,7 +7532,7 @@ public class JavaGenerator extends AbstractGenerator {
out.println("}");
}
else {
out.println("%sclass %s extends %s[[before= implements ][%s]] {", visibility(), className, SchemaImpl.class, interfaces);
out.println("%sclass %s extends %s[[before= implements ][%s]] {", visibility(), className, classExtends, interfaces);
out.printSerial();
out.javadoc("The reference instance of <code>%s</code>", schemaName);
out.println("%sstatic final %s %s = new %s();", visibility(), className, schemaId, className);
@ -8167,6 +8161,7 @@ public class JavaGenerator extends AbstractGenerator {
? routine.getReturnType(resolver(out)).getBinding()
: null));
final String classExtends = out.ref(getStrategy().getJavaClassExtends(routine));
final List<String> interfaces = out.ref(getStrategy().getJavaClassImplements(routine, Mode.DEFAULT));
final String schemaId = out.ref(getStrategy().getFullJavaIdentifier(schema), 2);
final List<String> packageId = out.ref(getStrategy().getFullJavaIdentifiers(routine.getPackage()), 2);
@ -8204,16 +8199,16 @@ public class JavaGenerator extends AbstractGenerator {
if (scala) {
out.println("%sclass %s extends %s[%s](\"%s\", %s[[before=, ][%s]][[before=, ][%s]]" + converterTemplate(returnConverter) + converterTemplate(returnBinding) + ")[[before= with ][separator= with ][%s]] {",
visibility(), className, AbstractRoutine.class, returnType, escapeString(routine.getName()), schemaId, packageId, returnTypeRef, returnConverter, returnBinding, interfaces);
visibility(), className, classExtends, returnType, escapeString(routine.getName()), schemaId, packageId, returnTypeRef, returnConverter, returnBinding, interfaces);
}
else {
if (kotlin) {
out.println("%sopen class %s : %s<%s>(\"%s\", %s[[before=, ][%s]][[before=, ][%s]]" + converterTemplate(returnConverter) + converterTemplate(returnBinding) + ")[[before=, ][%s]] {",
visibility(), className, AbstractRoutine.class, returnType, escapeString(routine.getName()), schemaId, packageId, returnTypeRef, returnConverter, returnBinding, interfaces);
visibility(), className, classExtends, returnType, escapeString(routine.getName()), schemaId, packageId, returnTypeRef, returnConverter, returnBinding, interfaces);
}
else {
out.println("%sclass %s extends %s<%s>[[before= implements ][%s]] {",
visibility(), className, AbstractRoutine.class, returnType, interfaces);
visibility(), className, classExtends, returnType, interfaces);
out.printSerial();
}

View File

@ -305,11 +305,28 @@ public class MatcherStrategy extends DefaultGeneratorStrategy {
@Override
public String getJavaClassExtends(Definition definition, Mode mode) {
for (MatchersCatalogType catalogs : catalogs(definition)) {
String result = match(definition, catalogs.getExpression(), catalogs.getCatalogExtends());
if (result != null)
return result;
}
for (MatchersSchemaType schemas : schemas(definition)) {
String result = match(definition, schemas.getExpression(), schemas.getSchemaExtends());
if (result != null)
return result;
}
for (MatchersTableType tables : tables(definition)) {
String result = null;
switch (mode) {
case POJO: result = match(definition, tables.getExpression(), tables.getPojoExtends()); break;
case RECORD: result = match(definition, tables.getExpression(), tables.getRecordExtends()); break;
case DAO: result = match(definition, tables.getExpression(), tables.getDaoExtends()); break;
case DEFAULT: result = match(definition, tables.getExpression(), tables.getTableExtends()); break;
}
if (result != null)
@ -321,12 +338,20 @@ public class MatcherStrategy extends DefaultGeneratorStrategy {
switch (mode) {
case POJO: result = match(definition, embeddables.getExpression(), embeddables.getPojoExtends()); break;
case RECORD: result = match(definition, embeddables.getExpression(), embeddables.getRecordExtends()); break;
}
if (result != null)
return result;
}
for (MatchersRoutineType routines : routines(definition)) {
String result = match(definition, routines.getExpression(), routines.getRoutineExtends());
if (result != null)
return result;
}
// Default to standard behaviour
return super.getJavaClassExtends(definition, mode);
}

View File

@ -33,6 +33,8 @@ public class MatchersCatalogType implements Serializable, XMLAppendable
protected MatcherRule catalogClass;
protected MatcherRule catalogIdentifier;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String catalogExtends;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String catalogImplements;
/**
@ -83,6 +85,28 @@ public class MatchersCatalogType implements Serializable, XMLAppendable
this.catalogIdentifier = value;
}
/**
* This string provides a super class that a generated {@link org.jooq.Catalog} should extend.
* <p>
* jOOQ internals make a few assumptions about what a {@link org.jooq.Catalog} does, so to minimise
* unexpected behaviour, custom catalog super classes should extend {@link org.jooq.impl.CatalogImpl}.
*
*/
public String getCatalogExtends() {
return catalogExtends;
}
/**
* This string provides a super class that a generated {@link org.jooq.Catalog} should extend.
* <p>
* jOOQ internals make a few assumptions about what a {@link org.jooq.Catalog} does, so to minimise
* unexpected behaviour, custom catalog super classes should extend {@link org.jooq.impl.CatalogImpl}.
*
*/
public void setCatalogExtends(String value) {
this.catalogExtends = value;
}
/**
* This string provides additional interfaces that a generated {@link org.jooq.Catalog} should implement.
*
@ -126,6 +150,18 @@ public class MatchersCatalogType implements Serializable, XMLAppendable
return this;
}
/**
* This string provides a super class that a generated {@link org.jooq.Catalog} should extend.
* <p>
* jOOQ internals make a few assumptions about what a {@link org.jooq.Catalog} does, so to minimise
* unexpected behaviour, custom catalog super classes should extend {@link org.jooq.impl.CatalogImpl}.
*
*/
public MatchersCatalogType withCatalogExtends(String value) {
setCatalogExtends(value);
return this;
}
/**
* This string provides additional interfaces that a generated {@link org.jooq.Catalog} should implement.
*
@ -140,6 +176,7 @@ public class MatchersCatalogType implements Serializable, XMLAppendable
builder.append("expression", expression);
builder.append("catalogClass", catalogClass);
builder.append("catalogIdentifier", catalogIdentifier);
builder.append("catalogExtends", catalogExtends);
builder.append("catalogImplements", catalogImplements);
}
@ -189,6 +226,15 @@ public class MatchersCatalogType implements Serializable, XMLAppendable
return false;
}
}
if (catalogExtends == null) {
if (other.catalogExtends!= null) {
return false;
}
} else {
if (!catalogExtends.equals(other.catalogExtends)) {
return false;
}
}
if (catalogImplements == null) {
if (other.catalogImplements!= null) {
return false;
@ -208,6 +254,7 @@ public class MatchersCatalogType implements Serializable, XMLAppendable
result = ((prime*result)+((expression == null)? 0 :expression.hashCode()));
result = ((prime*result)+((catalogClass == null)? 0 :catalogClass.hashCode()));
result = ((prime*result)+((catalogIdentifier == null)? 0 :catalogIdentifier.hashCode()));
result = ((prime*result)+((catalogExtends == null)? 0 :catalogExtends.hashCode()));
result = ((prime*result)+((catalogImplements == null)? 0 :catalogImplements.hashCode()));
return result;
}

View File

@ -32,6 +32,8 @@ public class MatchersEmbeddableType implements Serializable, XMLAppendable
protected String expression;
protected MatcherRule recordClass;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String recordExtends;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String recordImplements;
protected MatcherRule interfaceClass;
@XmlJavaTypeAdapter(StringAdapter.class)
@ -74,6 +76,28 @@ public class MatchersEmbeddableType implements Serializable, XMLAppendable
this.recordClass = value;
}
/**
* This string provides a super class that a generated {@link org.jooq.EmbeddableRecord} should extend.
* <p>
* jOOQ internals make a few assumptions about what a {@link org.jooq.EmbeddableRecord} does, so to minimise
* unexpected behaviour, custom embeddable record super classes should extend {@link org.jooq.impl.EmbeddableRecordImpl}.
*
*/
public String getRecordExtends() {
return recordExtends;
}
/**
* This string provides a super class that a generated {@link org.jooq.EmbeddableRecord} should extend.
* <p>
* jOOQ internals make a few assumptions about what a {@link org.jooq.EmbeddableRecord} does, so to minimise
* unexpected behaviour, custom embeddable record super classes should extend {@link org.jooq.impl.EmbeddableRecordImpl}.
*
*/
public void setRecordExtends(String value) {
this.recordExtends = value;
}
/**
* This string provides additional interfaces that a generated {@link org.jooq.EmbeddableRecord} should implement.
*
@ -188,6 +212,18 @@ public class MatchersEmbeddableType implements Serializable, XMLAppendable
return this;
}
/**
* This string provides a super class that a generated {@link org.jooq.EmbeddableRecord} should extend.
* <p>
* jOOQ internals make a few assumptions about what a {@link org.jooq.EmbeddableRecord} does, so to minimise
* unexpected behaviour, custom embeddable record super classes should extend {@link org.jooq.impl.EmbeddableRecordImpl}.
*
*/
public MatchersEmbeddableType withRecordExtends(String value) {
setRecordExtends(value);
return this;
}
/**
* This string provides additional interfaces that a generated {@link org.jooq.EmbeddableRecord} should implement.
*
@ -246,6 +282,7 @@ public class MatchersEmbeddableType implements Serializable, XMLAppendable
public final void appendTo(XMLBuilder builder) {
builder.append("expression", expression);
builder.append("recordClass", recordClass);
builder.append("recordExtends", recordExtends);
builder.append("recordImplements", recordImplements);
builder.append("interfaceClass", interfaceClass);
builder.append("interfaceImplements", interfaceImplements);
@ -291,6 +328,15 @@ public class MatchersEmbeddableType implements Serializable, XMLAppendable
return false;
}
}
if (recordExtends == null) {
if (other.recordExtends!= null) {
return false;
}
} else {
if (!recordExtends.equals(other.recordExtends)) {
return false;
}
}
if (recordImplements == null) {
if (other.recordImplements!= null) {
return false;
@ -354,6 +400,7 @@ public class MatchersEmbeddableType implements Serializable, XMLAppendable
int result = 1;
result = ((prime*result)+((expression == null)? 0 :expression.hashCode()));
result = ((prime*result)+((recordClass == null)? 0 :recordClass.hashCode()));
result = ((prime*result)+((recordExtends == null)? 0 :recordExtends.hashCode()));
result = ((prime*result)+((recordImplements == null)? 0 :recordImplements.hashCode()));
result = ((prime*result)+((interfaceClass == null)? 0 :interfaceClass.hashCode()));
result = ((prime*result)+((interfaceImplements == null)? 0 :interfaceImplements.hashCode()));

View File

@ -33,6 +33,8 @@ public class MatchersRoutineType implements Serializable, XMLAppendable
protected MatcherRule routineClass;
protected MatcherRule routineMethod;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String routineExtends;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String routineImplements;
/**
@ -83,6 +85,28 @@ public class MatchersRoutineType implements Serializable, XMLAppendable
this.routineMethod = value;
}
/**
* This string provides a super class that a generated {@link org.jooq.Routine} should extend.
* <p>
* jOOQ internals make a few assumptions about what a {@link org.jooq.Routine} does, so to minimise
* unexpected behaviour, custom routine super classes should extend {@link org.jooq.impl.AbstractRoutine}.
*
*/
public String getRoutineExtends() {
return routineExtends;
}
/**
* This string provides a super class that a generated {@link org.jooq.Routine} should extend.
* <p>
* jOOQ internals make a few assumptions about what a {@link org.jooq.Routine} does, so to minimise
* unexpected behaviour, custom routine super classes should extend {@link org.jooq.impl.AbstractRoutine}.
*
*/
public void setRoutineExtends(String value) {
this.routineExtends = value;
}
/**
* This string provides additional interfaces that a generated {@link org.jooq.Routine} should implement.
*
@ -126,6 +150,18 @@ public class MatchersRoutineType implements Serializable, XMLAppendable
return this;
}
/**
* This string provides a super class that a generated {@link org.jooq.Routine} should extend.
* <p>
* jOOQ internals make a few assumptions about what a {@link org.jooq.Routine} does, so to minimise
* unexpected behaviour, custom routine super classes should extend {@link org.jooq.impl.AbstractRoutine}.
*
*/
public MatchersRoutineType withRoutineExtends(String value) {
setRoutineExtends(value);
return this;
}
/**
* This string provides additional interfaces that a generated {@link org.jooq.Routine} should implement.
*
@ -140,6 +176,7 @@ public class MatchersRoutineType implements Serializable, XMLAppendable
builder.append("expression", expression);
builder.append("routineClass", routineClass);
builder.append("routineMethod", routineMethod);
builder.append("routineExtends", routineExtends);
builder.append("routineImplements", routineImplements);
}
@ -189,6 +226,15 @@ public class MatchersRoutineType implements Serializable, XMLAppendable
return false;
}
}
if (routineExtends == null) {
if (other.routineExtends!= null) {
return false;
}
} else {
if (!routineExtends.equals(other.routineExtends)) {
return false;
}
}
if (routineImplements == null) {
if (other.routineImplements!= null) {
return false;
@ -208,6 +254,7 @@ public class MatchersRoutineType implements Serializable, XMLAppendable
result = ((prime*result)+((expression == null)? 0 :expression.hashCode()));
result = ((prime*result)+((routineClass == null)? 0 :routineClass.hashCode()));
result = ((prime*result)+((routineMethod == null)? 0 :routineMethod.hashCode()));
result = ((prime*result)+((routineExtends == null)? 0 :routineExtends.hashCode()));
result = ((prime*result)+((routineImplements == null)? 0 :routineImplements.hashCode()));
return result;
}

View File

@ -33,6 +33,8 @@ public class MatchersSchemaType implements Serializable, XMLAppendable
protected MatcherRule schemaClass;
protected MatcherRule schemaIdentifier;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String schemaExtends;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String schemaImplements;
/**
@ -83,6 +85,28 @@ public class MatchersSchemaType implements Serializable, XMLAppendable
this.schemaIdentifier = value;
}
/**
* This string provides a super class that a generated {@link org.jooq.Schema} should extend.
* <p>
* jOOQ internals make a few assumptions about what a {@link org.jooq.Schema} does, so to minimise
* unexpected behaviour, custom schema super classes should extend {@link org.jooq.impl.SchemaImpl}.
*
*/
public String getSchemaExtends() {
return schemaExtends;
}
/**
* This string provides a super class that a generated {@link org.jooq.Schema} should extend.
* <p>
* jOOQ internals make a few assumptions about what a {@link org.jooq.Schema} does, so to minimise
* unexpected behaviour, custom schema super classes should extend {@link org.jooq.impl.SchemaImpl}.
*
*/
public void setSchemaExtends(String value) {
this.schemaExtends = value;
}
/**
* This string provides additional interfaces that a generated {@link org.jooq.Schema} should implement.
*
@ -126,6 +150,18 @@ public class MatchersSchemaType implements Serializable, XMLAppendable
return this;
}
/**
* This string provides a super class that a generated {@link org.jooq.Schema} should extend.
* <p>
* jOOQ internals make a few assumptions about what a {@link org.jooq.Schema} does, so to minimise
* unexpected behaviour, custom schema super classes should extend {@link org.jooq.impl.SchemaImpl}.
*
*/
public MatchersSchemaType withSchemaExtends(String value) {
setSchemaExtends(value);
return this;
}
/**
* This string provides additional interfaces that a generated {@link org.jooq.Schema} should implement.
*
@ -140,6 +176,7 @@ public class MatchersSchemaType implements Serializable, XMLAppendable
builder.append("expression", expression);
builder.append("schemaClass", schemaClass);
builder.append("schemaIdentifier", schemaIdentifier);
builder.append("schemaExtends", schemaExtends);
builder.append("schemaImplements", schemaImplements);
}
@ -189,6 +226,15 @@ public class MatchersSchemaType implements Serializable, XMLAppendable
return false;
}
}
if (schemaExtends == null) {
if (other.schemaExtends!= null) {
return false;
}
} else {
if (!schemaExtends.equals(other.schemaExtends)) {
return false;
}
}
if (schemaImplements == null) {
if (other.schemaImplements!= null) {
return false;
@ -208,6 +254,7 @@ public class MatchersSchemaType implements Serializable, XMLAppendable
result = ((prime*result)+((expression == null)? 0 :expression.hashCode()));
result = ((prime*result)+((schemaClass == null)? 0 :schemaClass.hashCode()));
result = ((prime*result)+((schemaIdentifier == null)? 0 :schemaIdentifier.hashCode()));
result = ((prime*result)+((schemaExtends == null)? 0 :schemaExtends.hashCode()));
result = ((prime*result)+((schemaImplements == null)? 0 :schemaImplements.hashCode()));
return result;
}

View File

@ -33,15 +33,21 @@ public class MatchersTableType implements Serializable, XMLAppendable
protected MatcherRule tableClass;
protected MatcherRule tableIdentifier;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String tableExtends;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String tableImplements;
protected MatcherRule recordClass;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String recordExtends;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String recordImplements;
protected MatcherRule interfaceClass;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String interfaceImplements;
protected MatcherRule daoClass;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String daoExtends;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String daoImplements;
protected MatcherRule pojoClass;
@XmlJavaTypeAdapter(StringAdapter.class)
@ -97,6 +103,28 @@ public class MatchersTableType implements Serializable, XMLAppendable
this.tableIdentifier = value;
}
/**
* This string provides a super class that a generated {@link org.jooq.Table} should extend.
* <p>
* jOOQ internals make a few assumptions about what a {@link org.jooq.Table} does, so to minimise
* unexpected behaviour, custom table super classes should extend {@link org.jooq.impl.TableImpl}.
*
*/
public String getTableExtends() {
return tableExtends;
}
/**
* This string provides a super class that a generated {@link org.jooq.Table} should extend.
* <p>
* jOOQ internals make a few assumptions about what a {@link org.jooq.Table} does, so to minimise
* unexpected behaviour, custom table super classes should extend {@link org.jooq.impl.TableImpl}.
*
*/
public void setTableExtends(String value) {
this.tableExtends = value;
}
/**
* This string provides additional interfaces that a generated {@link org.jooq.Table} should implement.
*
@ -129,6 +157,28 @@ public class MatchersTableType implements Serializable, XMLAppendable
this.recordClass = value;
}
/**
* This string provides a super class that a generated {@link org.jooq.TableRecord} should extend.
* <p>
* jOOQ internals make a few assumptions about what a {@link org.jooq.TableRecord} does, so to minimise
* unexpected behaviour, custom table record super classes should extend {@link org.jooq.impl.TableRecordImpl}.
*
*/
public String getRecordExtends() {
return recordExtends;
}
/**
* This string provides a super class that a generated {@link org.jooq.TableRecord} should extend.
* <p>
* jOOQ internals make a few assumptions about what a {@link org.jooq.TableRecord} does, so to minimise
* unexpected behaviour, custom table record super classes should extend {@link org.jooq.impl.TableRecordImpl}.
*
*/
public void setRecordExtends(String value) {
this.recordExtends = value;
}
/**
* This string provides additional interfaces that a generated {@link org.jooq.TableRecord} should implement.
*
@ -193,6 +243,28 @@ public class MatchersTableType implements Serializable, XMLAppendable
this.daoClass = value;
}
/**
* This string provides a super class that a generated {@link org.jooq.DAO} should extend.
* <p>
* jOOQ internals make a few assumptions about what a {@link org.jooq.DAO} does, so to minimise
* unexpected behaviour, custom DAO super classes should extend {@link org.jooq.impl.DAOImpl}.
*
*/
public String getDaoExtends() {
return daoExtends;
}
/**
* This string provides a super class that a generated {@link org.jooq.DAO} should extend.
* <p>
* jOOQ internals make a few assumptions about what a {@link org.jooq.DAO} does, so to minimise
* unexpected behaviour, custom DAO super classes should extend {@link org.jooq.impl.DAOImpl}.
*
*/
public void setDaoExtends(String value) {
this.daoExtends = value;
}
/**
* This string provides additional interfaces that a generated {@link org.jooq.DAO} should implement.
*
@ -284,6 +356,18 @@ public class MatchersTableType implements Serializable, XMLAppendable
return this;
}
/**
* This string provides a super class that a generated {@link org.jooq.Table} should extend.
* <p>
* jOOQ internals make a few assumptions about what a {@link org.jooq.Table} does, so to minimise
* unexpected behaviour, custom table super classes should extend {@link org.jooq.impl.TableImpl}.
*
*/
public MatchersTableType withTableExtends(String value) {
setTableExtends(value);
return this;
}
/**
* This string provides additional interfaces that a generated {@link org.jooq.Table} should implement.
*
@ -302,6 +386,18 @@ public class MatchersTableType implements Serializable, XMLAppendable
return this;
}
/**
* This string provides a super class that a generated {@link org.jooq.TableRecord} should extend.
* <p>
* jOOQ internals make a few assumptions about what a {@link org.jooq.TableRecord} does, so to minimise
* unexpected behaviour, custom table record super classes should extend {@link org.jooq.impl.TableRecordImpl}.
*
*/
public MatchersTableType withRecordExtends(String value) {
setRecordExtends(value);
return this;
}
/**
* This string provides additional interfaces that a generated {@link org.jooq.TableRecord} should implement.
*
@ -338,6 +434,18 @@ public class MatchersTableType implements Serializable, XMLAppendable
return this;
}
/**
* This string provides a super class that a generated {@link org.jooq.DAO} should extend.
* <p>
* jOOQ internals make a few assumptions about what a {@link org.jooq.DAO} does, so to minimise
* unexpected behaviour, custom DAO super classes should extend {@link org.jooq.impl.DAOImpl}.
*
*/
public MatchersTableType withDaoExtends(String value) {
setDaoExtends(value);
return this;
}
/**
* This string provides additional interfaces that a generated {@link org.jooq.DAO} should implement.
*
@ -379,12 +487,15 @@ public class MatchersTableType implements Serializable, XMLAppendable
builder.append("expression", expression);
builder.append("tableClass", tableClass);
builder.append("tableIdentifier", tableIdentifier);
builder.append("tableExtends", tableExtends);
builder.append("tableImplements", tableImplements);
builder.append("recordClass", recordClass);
builder.append("recordExtends", recordExtends);
builder.append("recordImplements", recordImplements);
builder.append("interfaceClass", interfaceClass);
builder.append("interfaceImplements", interfaceImplements);
builder.append("daoClass", daoClass);
builder.append("daoExtends", daoExtends);
builder.append("daoImplements", daoImplements);
builder.append("pojoClass", pojoClass);
builder.append("pojoExtends", pojoExtends);
@ -437,6 +548,15 @@ public class MatchersTableType implements Serializable, XMLAppendable
return false;
}
}
if (tableExtends == null) {
if (other.tableExtends!= null) {
return false;
}
} else {
if (!tableExtends.equals(other.tableExtends)) {
return false;
}
}
if (tableImplements == null) {
if (other.tableImplements!= null) {
return false;
@ -455,6 +575,15 @@ public class MatchersTableType implements Serializable, XMLAppendable
return false;
}
}
if (recordExtends == null) {
if (other.recordExtends!= null) {
return false;
}
} else {
if (!recordExtends.equals(other.recordExtends)) {
return false;
}
}
if (recordImplements == null) {
if (other.recordImplements!= null) {
return false;
@ -491,6 +620,15 @@ public class MatchersTableType implements Serializable, XMLAppendable
return false;
}
}
if (daoExtends == null) {
if (other.daoExtends!= null) {
return false;
}
} else {
if (!daoExtends.equals(other.daoExtends)) {
return false;
}
}
if (daoImplements == null) {
if (other.daoImplements!= null) {
return false;
@ -537,12 +675,15 @@ public class MatchersTableType implements Serializable, XMLAppendable
result = ((prime*result)+((expression == null)? 0 :expression.hashCode()));
result = ((prime*result)+((tableClass == null)? 0 :tableClass.hashCode()));
result = ((prime*result)+((tableIdentifier == null)? 0 :tableIdentifier.hashCode()));
result = ((prime*result)+((tableExtends == null)? 0 :tableExtends.hashCode()));
result = ((prime*result)+((tableImplements == null)? 0 :tableImplements.hashCode()));
result = ((prime*result)+((recordClass == null)? 0 :recordClass.hashCode()));
result = ((prime*result)+((recordExtends == null)? 0 :recordExtends.hashCode()));
result = ((prime*result)+((recordImplements == null)? 0 :recordImplements.hashCode()));
result = ((prime*result)+((interfaceClass == null)? 0 :interfaceClass.hashCode()));
result = ((prime*result)+((interfaceImplements == null)? 0 :interfaceImplements.hashCode()));
result = ((prime*result)+((daoClass == null)? 0 :daoClass.hashCode()));
result = ((prime*result)+((daoExtends == null)? 0 :daoExtends.hashCode()));
result = ((prime*result)+((daoImplements == null)? 0 :daoImplements.hashCode()));
result = ((prime*result)+((pojoClass == null)? 0 :pojoClass.hashCode()));
result = ((prime*result)+((pojoExtends == null)? 0 :pojoExtends.hashCode()));

View File

@ -222,6 +222,14 @@
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This rule influences the naming of the generated {@link org.jooq.Catalog} identifier.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="catalogExtends" type="string" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This string provides a super class that a generated {@link org.jooq.Catalog} should extend.
<p>
jOOQ internals make a few assumptions about what a {@link org.jooq.Catalog} does, so to minimise
unexpected behaviour, custom catalog super classes should extend {@link org.jooq.impl.CatalogImpl}
and follow its (undocumented!) assumptions (e.g. constructors, etc.). Use this at your own risk.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="catalogImplements" type="string" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This string provides additional interfaces that a generated {@link org.jooq.Catalog} should implement.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
@ -249,6 +257,14 @@
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This rule influences the naming of the generated {@link org.jooq.Schema} identifier.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="schemaExtends" type="string" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This string provides a super class that a generated {@link org.jooq.Schema} should extend.
<p>
jOOQ internals make a few assumptions about what a {@link org.jooq.Schema} does, so to minimise
unexpected behaviour, custom schema super classes should extend {@link org.jooq.impl.SchemaImpl}
and follow its (undocumented!) assumptions (e.g. constructors, etc.). Use this at your own risk.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="schemaImplements" type="string" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This string provides additional interfaces that a generated {@link org.jooq.Schema} should implement.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
@ -276,6 +292,14 @@
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This rule influences the naming of the generated {@link org.jooq.Table} identifier.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="tableExtends" type="string" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This string provides a super class that a generated {@link org.jooq.Table} should extend.
<p>
jOOQ internals make a few assumptions about what a {@link org.jooq.Table} does, so to minimise
unexpected behaviour, custom table super classes should extend {@link org.jooq.impl.TableImpl}
and follow its (undocumented!) assumptions (e.g. constructors, etc.). Use this at your own risk.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="tableImplements" type="string" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This string provides additional interfaces that a generated {@link org.jooq.Table} should implement.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
@ -284,6 +308,14 @@
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This rule influences the naming of the generated {@link org.jooq.TableRecord} object.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="recordExtends" type="string" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This string provides a super class that a generated {@link org.jooq.TableRecord} should extend.
<p>
jOOQ internals make a few assumptions about what a {@link org.jooq.TableRecord} does, so to minimise
unexpected behaviour, custom table record super classes should extend {@link org.jooq.impl.TableRecordImpl}
and follow its (undocumented!) assumptions (e.g. constructors, etc.). Use this at your own risk.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="recordImplements" type="string" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This string provides additional interfaces that a generated {@link org.jooq.TableRecord} should implement.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
@ -300,6 +332,14 @@
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This rule influences the naming of the generated {@link org.jooq.DAO} object.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="daoExtends" type="string" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This string provides a super class that a generated {@link org.jooq.DAO} should extend.
<p>
jOOQ internals make a few assumptions about what a {@link org.jooq.DAO} does, so to minimise
unexpected behaviour, custom DAO super classes should extend {@link org.jooq.impl.DAOImpl}
and follow its (undocumented!) assumptions (e.g. constructors, etc.). Use this at your own risk.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="daoImplements" type="string" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This string provides additional interfaces that a generated {@link org.jooq.DAO} should implement.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
@ -370,6 +410,14 @@
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This rule influences the naming of generated convenience methods used to call the {@link org.jooq.Routine}.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="routineExtends" type="string" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This string provides a super class that a generated {@link org.jooq.Routine} should extend.
<p>
jOOQ internals make a few assumptions about what a {@link org.jooq.Routine} does, so to minimise
unexpected behaviour, custom routine super classes should extend {@link org.jooq.impl.AbstractRoutine}
and follow its (undocumented!) assumptions (e.g. constructors, etc.). Use this at your own risk.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="routineImplements" type="string" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This string provides additional interfaces that a generated {@link org.jooq.Routine} should implement.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
@ -439,6 +487,14 @@
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This rule influences the naming of the generated {@link org.jooq.EmbeddableRecord} object.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="recordExtends" type="string" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This string provides a super class that a generated {@link org.jooq.EmbeddableRecord} should extend.
<p>
jOOQ internals make a few assumptions about what a {@link org.jooq.EmbeddableRecord} does, so to minimise
unexpected behaviour, custom embeddable record super classes should extend {@link org.jooq.impl.EmbeddableRecordImpl}
and follow its (undocumented!) assumptions (e.g. constructors, etc.). Use this at your own risk.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="recordImplements" type="string" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This string provides additional interfaces that a generated {@link org.jooq.EmbeddableRecord} should implement.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>