[#7809] Generate overridden Table.fieldsRow() method in generated tables
This commit is contained in:
parent
14d9703a10
commit
70fe064517
@ -4374,6 +4374,27 @@ public class JavaGenerator extends AbstractGenerator {
|
||||
out.tab(1).println("}");
|
||||
}
|
||||
|
||||
// [#7809] fieldsRow()
|
||||
int degree = table.getColumns().size();
|
||||
String rowType = refRowType(out, table.getColumns());
|
||||
|
||||
if (generateRecordsImplementingRecordN() && degree > 0 && degree <= Constants.MAX_ROW_DEGREE) {
|
||||
out.tab(1).header("Row%s type methods", degree);
|
||||
|
||||
if (scala) {
|
||||
out.println();
|
||||
out.tab(1).println("override def fieldsRow : %s[%s] = {", out.ref(Row.class.getName() + degree), rowType);
|
||||
out.tab(2).println("super.fieldsRow.asInstanceOf[ %s[%s] ]", out.ref(Row.class.getName() + degree), rowType);
|
||||
out.tab(1).println("}");
|
||||
}
|
||||
else {
|
||||
out.tab(1).overrideInherit();
|
||||
out.tab(1).println("public %s<%s> fieldsRow() {", out.ref(Row.class.getName() + degree), rowType);
|
||||
out.tab(2).println("return (%s) super.fieldsRow();", out.ref(Row.class.getName() + degree));
|
||||
out.tab(1).println("}");
|
||||
}
|
||||
}
|
||||
|
||||
// [#1070] Table-valued functions should generate an additional set of call() methods
|
||||
if (table.isTableValuedFunction()) {
|
||||
for (boolean parametersAsField : new boolean[] { false, true }) {
|
||||
|
||||
@ -13,6 +13,7 @@ import org.jooq.Identity;
|
||||
import org.jooq.Index;
|
||||
import org.jooq.Name;
|
||||
import org.jooq.Record;
|
||||
import org.jooq.Row3;
|
||||
import org.jooq.Schema;
|
||||
import org.jooq.Table;
|
||||
import org.jooq.TableField;
|
||||
@ -31,7 +32,7 @@ import org.jooq.impl.TableImpl;
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class Actor extends TableImpl<ActorRecord> {
|
||||
|
||||
private static final long serialVersionUID = -197980969;
|
||||
private static final long serialVersionUID = -1700943295;
|
||||
|
||||
/**
|
||||
* The reference instance of <code>PUBLIC.ACTOR</code>
|
||||
@ -165,4 +166,16 @@ public class Actor extends TableImpl<ActorRecord> {
|
||||
public Actor rename(Name name) {
|
||||
return new Actor(name, null);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Row3 type methods
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Row3<Integer, String, String> fieldsRow() {
|
||||
return (Row3) super.fieldsRow();
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,6 +14,7 @@ import org.jooq.Identity;
|
||||
import org.jooq.Index;
|
||||
import org.jooq.Name;
|
||||
import org.jooq.Record;
|
||||
import org.jooq.Row6;
|
||||
import org.jooq.Schema;
|
||||
import org.jooq.Table;
|
||||
import org.jooq.TableField;
|
||||
@ -32,7 +33,7 @@ import org.jooq.impl.TableImpl;
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class Film extends TableImpl<FilmRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1598245119;
|
||||
private static final long serialVersionUID = -1567412069;
|
||||
|
||||
/**
|
||||
* The reference instance of <code>PUBLIC.FILM</code>
|
||||
@ -197,4 +198,16 @@ public class Film extends TableImpl<FilmRecord> {
|
||||
public Film rename(Name name) {
|
||||
return new Film(name, null);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Row6 type methods
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Row6<Integer, Integer, Year, String, Integer, Integer> fieldsRow() {
|
||||
return (Row6) super.fieldsRow();
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ import org.jooq.ForeignKey;
|
||||
import org.jooq.Index;
|
||||
import org.jooq.Name;
|
||||
import org.jooq.Record;
|
||||
import org.jooq.Row2;
|
||||
import org.jooq.Schema;
|
||||
import org.jooq.Table;
|
||||
import org.jooq.TableField;
|
||||
@ -30,7 +31,7 @@ import org.jooq.impl.TableImpl;
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class FilmActor extends TableImpl<FilmActorRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1565489533;
|
||||
private static final long serialVersionUID = -1107628909;
|
||||
|
||||
/**
|
||||
* The reference instance of <code>PUBLIC.FILM_ACTOR</code>
|
||||
@ -167,4 +168,16 @@ public class FilmActor extends TableImpl<FilmActorRecord> {
|
||||
public FilmActor rename(Name name) {
|
||||
return new FilmActor(name, null);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Row2 type methods
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Row2<Integer, Integer> fieldsRow() {
|
||||
return (Row2) super.fieldsRow();
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ import org.jooq.Identity;
|
||||
import org.jooq.Index;
|
||||
import org.jooq.Name;
|
||||
import org.jooq.Record;
|
||||
import org.jooq.Row2;
|
||||
import org.jooq.Schema;
|
||||
import org.jooq.Table;
|
||||
import org.jooq.TableField;
|
||||
@ -31,7 +32,7 @@ import org.jooq.impl.TableImpl;
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class Language extends TableImpl<LanguageRecord> {
|
||||
|
||||
private static final long serialVersionUID = -636203274;
|
||||
private static final long serialVersionUID = -2110031383;
|
||||
|
||||
/**
|
||||
* The reference instance of <code>PUBLIC.LANGUAGE</code>
|
||||
@ -160,4 +161,16 @@ public class Language extends TableImpl<LanguageRecord> {
|
||||
public Language rename(Name name) {
|
||||
return new Language(name, null);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Row2 type methods
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Row2<Integer, String> fieldsRow() {
|
||||
return (Row2) super.fieldsRow();
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,9 +223,12 @@ abstract class AbstractTable<R extends Record> extends AbstractNamed implements
|
||||
return DSL.using(new DefaultConfiguration()).newRecord(this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Subclasses may override this method
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes" })
|
||||
@Override
|
||||
public final Row fieldsRow() {
|
||||
public Row fieldsRow() {
|
||||
return new RowImpl(fields0());
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user