[#4248] daoImplements option in MatcherStrategy not generating an implements statement in DAO class
This commit is contained in:
parent
5939c31565
commit
50698a3e2f
@ -43,7 +43,6 @@ package org.jooq.util;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.jooq.DAO;
|
||||
import org.jooq.tools.StringUtils;
|
||||
// ...
|
||||
|
||||
@ -123,26 +122,7 @@ public class DefaultGeneratorStrategy extends AbstractGeneratorStrategy {
|
||||
|
||||
@Override
|
||||
public List<String> getJavaClassImplements(Definition definition, Mode mode) {
|
||||
List<String> result = new ArrayList<String>();
|
||||
|
||||
if (mode == Mode.DAO) {
|
||||
TableDefinition table = (TableDefinition) definition;
|
||||
List<ColumnDefinition> keyColumns = table.getPrimaryKey().getKeyColumns();
|
||||
|
||||
String name = DAO.class.getName();
|
||||
|
||||
name += "<";
|
||||
name += getFullJavaClassName(table, Mode.POJO);
|
||||
name += ", ";
|
||||
name += keyColumns.size() == 1
|
||||
? "Void" // keyColumns.get(0).getType()
|
||||
: "Void";
|
||||
name += ">";
|
||||
|
||||
result.add(name);
|
||||
}
|
||||
|
||||
return result;
|
||||
return new ArrayList<String>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -2066,7 +2066,14 @@ public class JavaGenerator extends AbstractGenerator {
|
||||
}
|
||||
|
||||
protected void generateDao(TableDefinition table, JavaWriter out) {
|
||||
UniqueKeyDefinition key = table.getPrimaryKey();
|
||||
if (key == null) {
|
||||
log.info("Skipping DAO generation", out.file().getName());
|
||||
return;
|
||||
}
|
||||
|
||||
final String className = getStrategy().getJavaClassName(table, Mode.DAO);
|
||||
final List<String> interfaces = out.ref(getStrategy().getJavaClassImplements(table, Mode.DAO));
|
||||
final String tableRecord = out.ref(getStrategy().getFullJavaClassName(table, Mode.RECORD));
|
||||
final String daoImpl = out.ref(DAOImpl.class);
|
||||
final String tableIdentifier = out.ref(getStrategy().getFullJavaIdentifier(table), 2);
|
||||
@ -2074,12 +2081,6 @@ public class JavaGenerator extends AbstractGenerator {
|
||||
String tType = (scala ? "Unit" : "Void");
|
||||
String pType = out.ref(getStrategy().getFullJavaClassName(table, Mode.POJO));
|
||||
|
||||
UniqueKeyDefinition key = table.getPrimaryKey();
|
||||
if (key == null) {
|
||||
log.info("Skipping DAO generation", out.file().getName());
|
||||
return;
|
||||
}
|
||||
|
||||
List<ColumnDefinition> keyColumns = key.getKeyColumns();
|
||||
|
||||
if (keyColumns.size() == 1) {
|
||||
@ -2110,10 +2111,10 @@ public class JavaGenerator extends AbstractGenerator {
|
||||
printClassAnnotations(out, table.getSchema());
|
||||
|
||||
if (scala)
|
||||
out.println("class %s(configuration : %s) extends %s[%s, %s, %s](%s, classOf[%s], configuration) {",
|
||||
className, Configuration.class, daoImpl, tableRecord, pType, tType, tableIdentifier, pType);
|
||||
out.println("class %s(configuration : %s) extends %s[%s, %s, %s](%s, classOf[%s], configuration)[[before= with ][%s]] {",
|
||||
className, Configuration.class, daoImpl, tableRecord, pType, tType, tableIdentifier, pType, interfaces);
|
||||
else
|
||||
out.println("public class %s extends %s<%s, %s, %s> {", className, daoImpl, tableRecord, pType, tType);
|
||||
out.println("public class %s extends %s<%s, %s, %s>[[before= implements ][%s]] {", className, daoImpl, tableRecord, pType, tType, interfaces);
|
||||
|
||||
// Default constructor
|
||||
// -------------------
|
||||
|
||||
Loading…
Reference in New Issue
Block a user