QueryBean generation - use full class names for TQRootBean, TQAssocBean

Rather than imports, such that these are not possible name clashes with
beans of the exact same name.
This commit is contained in:
Rob Bygrave
2023-11-28 21:51:07 +13:00
parent 29cd1a143d
commit a8ce726e47
2 changed files with 3 additions and 13 deletions
@@ -19,9 +19,6 @@ interface Constants {
String DBJSONB = "io.ebean.annotation.DbJsonB";
String DBNAME = "io.ebean.annotation.DbName";
String TQROOTBEAN = "io.ebean.typequery.TQRootBean";
String TQASSOCBEAN = "io.ebean.typequery.TQAssocBean";
String TQASSOC = "io.ebean.typequery.TQAssoc";
String DB = "io.ebean.DB";
String MODULEINFO = "io.ebean.config.ModuleInfo";
@@ -76,13 +76,6 @@ class SimpleQueryBeanWriter {
private void gatherPropertyDetails() {
importTypes.add(beanFullName);
if (embeddable) {
importTypes.add(Constants.TQASSOC);
} else {
importTypes.add(Constants.TQASSOCBEAN);
importTypes.add(Constants.TQROOTBEAN);
}
if (implementsInterface != null) {
implementsInterfaceFullName = implementsInterface.getQualifiedName().toString();
boolean nested = implementsInterface.getNestingKind().isNested();
@@ -233,7 +226,7 @@ class SimpleQueryBeanWriter {
writer.append("public final class Q%s {", shortName).eol();
} else {
writer.append(Constants.AT_TYPEQUERYBEAN).eol();
writer.append("public final class Q%s extends TQRootBean<%1$s,Q%1$s> {", shortName).eol();
writer.append("public final class Q%s extends io.ebean.typequery.TQRootBean<%1$s,Q%1$s> {", shortName).eol();
}
writer.eol();
}
@@ -272,9 +265,9 @@ class SimpleQueryBeanWriter {
writer.append(" ").append(Constants.AT_GENERATED).eol();
writer.append(" ").append(Constants.AT_TYPEQUERYBEAN).eol();
if (embeddable) {
writer.append(" public static final class Assoc<R> extends TQAssoc<%s,R> {", shortInnerName).eol();
writer.append(" public static final class Assoc<R> extends io.ebean.typequery.TQAssoc<%s,R> {", shortInnerName).eol();
} else {
writer.append(" public static final class Assoc<R> extends TQAssocBean<%s,R,Q%s> {", shortName, shortInnerName).eol();
writer.append(" public static final class Assoc<R> extends io.ebean.typequery.TQAssocBean<%s,R,Q%s> {", shortName, shortInnerName).eol();
}
for (PropertyMeta property : properties) {
writer.append(" ");