[jOOQ/jOOQ#15464] Support also pathExtends and pathImplements

This commit is contained in:
Lukas Eder 2023-08-14 15:03:02 +02:00
parent 7b55ae620e
commit 7777e5b46a
3 changed files with 88 additions and 4 deletions

View File

@ -369,10 +369,11 @@ public class MatcherStrategy extends DefaultGeneratorStrategy {
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;
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 PATH: result = match(definition, tables.getExpression(), tables.getPathExtends()); break;
case DEFAULT: result = match(definition, tables.getExpression(), tables.getTableExtends()); break;
}
if (result != null)
@ -427,6 +428,7 @@ public class MatcherStrategy extends DefaultGeneratorStrategy {
case INTERFACE: result = match(definition, tables.getExpression(), tables.getInterfaceImplements()); break;
case POJO: result = match(definition, tables.getExpression(), tables.getPojoImplements()); break;
case RECORD: result = match(definition, tables.getExpression(), tables.getRecordImplements()); break;
case PATH: result = match(definition, tables.getExpression(), tables.getTableImplements()); break;
}
if (result != null)

View File

@ -37,6 +37,8 @@ public class MatchersTableType implements Serializable, XMLAppendable
@XmlJavaTypeAdapter(StringAdapter.class)
protected String tableImplements;
protected MatcherRule pathClass;
protected MatcherRule pathExtends;
protected MatcherRule pathImplements;
protected MatcherRule recordClass;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String recordExtends;
@ -160,6 +162,38 @@ public class MatchersTableType implements Serializable, XMLAppendable
this.pathClass = value;
}
/**
* This string provides a super class that a generated {@link org.jooq.Table} and {@link org.jooq.Path} object should extend.
*
*/
public MatcherRule getPathExtends() {
return pathExtends;
}
/**
* This string provides a super class that a generated {@link org.jooq.Table} and {@link org.jooq.Path} object should extend.
*
*/
public void setPathExtends(MatcherRule value) {
this.pathExtends = value;
}
/**
* This string provides additional interfaces that a generated {@link org.jooq.Table} and {@link org.jooq.Path} object should implement.
*
*/
public MatcherRule getPathImplements() {
return pathImplements;
}
/**
* This string provides additional interfaces that a generated {@link org.jooq.Table} and {@link org.jooq.Path} object should implement.
*
*/
public void setPathImplements(MatcherRule value) {
this.pathImplements = value;
}
/**
* This rule influences the naming of the generated {@link org.jooq.TableRecord} object.
*
@ -410,6 +444,24 @@ public class MatchersTableType implements Serializable, XMLAppendable
return this;
}
/**
* This string provides a super class that a generated {@link org.jooq.Table} and {@link org.jooq.Path} object should extend.
*
*/
public MatchersTableType withPathExtends(MatcherRule value) {
setPathExtends(value);
return this;
}
/**
* This string provides additional interfaces that a generated {@link org.jooq.Table} and {@link org.jooq.Path} object should implement.
*
*/
public MatchersTableType withPathImplements(MatcherRule value) {
setPathImplements(value);
return this;
}
/**
* This rule influences the naming of the generated {@link org.jooq.TableRecord} object.
*
@ -525,6 +577,8 @@ public class MatchersTableType implements Serializable, XMLAppendable
builder.append("tableExtends", tableExtends);
builder.append("tableImplements", tableImplements);
builder.append("pathClass", pathClass);
builder.append("pathExtends", pathExtends);
builder.append("pathImplements", pathImplements);
builder.append("recordClass", recordClass);
builder.append("recordExtends", recordExtends);
builder.append("recordImplements", recordImplements);
@ -611,6 +665,24 @@ public class MatchersTableType implements Serializable, XMLAppendable
return false;
}
}
if (pathExtends == null) {
if (other.pathExtends!= null) {
return false;
}
} else {
if (!pathExtends.equals(other.pathExtends)) {
return false;
}
}
if (pathImplements == null) {
if (other.pathImplements!= null) {
return false;
}
} else {
if (!pathImplements.equals(other.pathImplements)) {
return false;
}
}
if (recordClass == null) {
if (other.recordClass!= null) {
return false;
@ -723,6 +795,8 @@ public class MatchersTableType implements Serializable, XMLAppendable
result = ((prime*result)+((tableExtends == null)? 0 :tableExtends.hashCode()));
result = ((prime*result)+((tableImplements == null)? 0 :tableImplements.hashCode()));
result = ((prime*result)+((pathClass == null)? 0 :pathClass.hashCode()));
result = ((prime*result)+((pathExtends == null)? 0 :pathExtends.hashCode()));
result = ((prime*result)+((pathImplements == null)? 0 :pathImplements.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()));

View File

@ -316,6 +316,14 @@ and follow its (undocumented!) assumptions (e.g. constructors, etc.). Use this a
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This rule influences the naming of the generated {@link org.jooq.Table} and {@link org.jooq.Path} object.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="pathExtends" type="tns:MatcherRule" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This string provides a super class that a generated {@link org.jooq.Table} and {@link org.jooq.Path} object should extend.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="pathImplements" type="tns:MatcherRule" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[This string provides additional interfaces that a generated {@link org.jooq.Table} and {@link org.jooq.Path} object should implement.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="recordClass" type="tns:MatcherRule" minOccurs="0" maxOccurs="1">
<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>