[#6532] Add UDT.isSynthetic() and UDTDefinition.isSynthetic()
This commit is contained in:
parent
eff0fe8c47
commit
2abecfc90d
@ -1838,6 +1838,7 @@ public class JavaGenerator extends AbstractGenerator {
|
||||
protected void generateUDT(UDTDefinition udt, JavaWriter out) {
|
||||
final SchemaDefinition schema = udt.getSchema();
|
||||
final PackageDefinition pkg = udt.getPackage();
|
||||
final boolean synthetic = udt.isSynthetic();
|
||||
final String className = getStrategy().getJavaClassName(udt);
|
||||
final String recordType = out.ref(getStrategy().getFullJavaClassName(udt, Mode.RECORD));
|
||||
final List<String> interfaces = out.ref(getStrategy().getJavaClassImplements(udt, Mode.DEFAULT));
|
||||
@ -1872,7 +1873,7 @@ public class JavaGenerator extends AbstractGenerator {
|
||||
}
|
||||
|
||||
if (scala) {
|
||||
out.println("class %s extends %s[%s](\"%s\", null[[before=, ][%s]])[[before= with ][separator= with ][%s]] {", className, UDTImpl.class, recordType, udt.getOutputName(), list(packageId), interfaces);
|
||||
out.println("class %s extends %s[%s](\"%s\", null, %s, %s)[[before= with ][separator= with ][%s]] {", className, UDTImpl.class, recordType, udt.getOutputName(), packageId, synthetic, interfaces);
|
||||
}
|
||||
else {
|
||||
out.println("public class %s extends %s<%s>[[before= implements ][%s]] {", className, UDTImpl.class, recordType, interfaces);
|
||||
@ -1936,7 +1937,7 @@ public class JavaGenerator extends AbstractGenerator {
|
||||
else {
|
||||
out.tab(1).javadoc(NO_FURTHER_INSTANCES_ALLOWED);
|
||||
out.tab(1).println("private %s() {", className);
|
||||
out.tab(2).println("super(\"%s\", null[[before=, ][%s]]);", udt.getOutputName(), list(packageId));
|
||||
out.tab(2).println("super(\"%s\", null, %s, %s);", udt.getOutputName(), packageId, synthetic);
|
||||
out.tab(1).println("}");
|
||||
}
|
||||
|
||||
|
||||
@ -49,13 +49,20 @@ implements
|
||||
UDTDefinition {
|
||||
|
||||
private List<RoutineDefinition> routines;
|
||||
private final boolean synthetic;
|
||||
|
||||
public AbstractUDTDefinition(SchemaDefinition schema, String name, String comment) {
|
||||
super(schema, null, name, comment);
|
||||
this(schema, null, name, false, comment);
|
||||
}
|
||||
|
||||
public AbstractUDTDefinition(SchemaDefinition schema, PackageDefinition pkg, String name, String comment) {
|
||||
this(schema, pkg, name, false, comment);
|
||||
}
|
||||
|
||||
public AbstractUDTDefinition(SchemaDefinition schema, PackageDefinition pkg, String name, boolean synthetic, String comment) {
|
||||
super(schema, pkg, name, comment);
|
||||
|
||||
this.synthetic = synthetic;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -88,4 +95,9 @@ implements
|
||||
public List<AttributeDefinition> getConstants() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSynthetic() {
|
||||
return synthetic;
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,4 +72,9 @@ public interface UDTDefinition extends PackageDefinition {
|
||||
*/
|
||||
@Override
|
||||
List<RoutineDefinition> getRoutines();
|
||||
|
||||
/**
|
||||
* Whether this UDT is a synthetic type.
|
||||
*/
|
||||
boolean isSynthetic();
|
||||
}
|
||||
|
||||
@ -178,4 +178,15 @@ public interface UDT<R extends UDTRecord<R>> extends QueryPart {
|
||||
* Whether this data type can be used from SQL statements.
|
||||
*/
|
||||
boolean isSQLUsable();
|
||||
|
||||
/**
|
||||
* Whether this data type is a synthetic, structural UDT type.
|
||||
* <p>
|
||||
* This is <code>true</code> for example:
|
||||
* <ul>
|
||||
* <li>For Oracle <code>TAB%ROWTYPE</code> references, which are synthetic
|
||||
* PL/SQL RECORD types in PL/SQL.</li>
|
||||
* </ul>
|
||||
*/
|
||||
boolean isSynthetic();
|
||||
}
|
||||
|
||||
@ -67,6 +67,7 @@ public class UDTImpl<R extends UDTRecord<R>> extends AbstractQueryPart implement
|
||||
private final String name;
|
||||
private final Fields<R> fields;
|
||||
private final Package pkg;
|
||||
private final boolean synthetic;
|
||||
private transient DataType<R> type;
|
||||
|
||||
public UDTImpl(String name, Schema schema) {
|
||||
@ -74,10 +75,15 @@ public class UDTImpl<R extends UDTRecord<R>> extends AbstractQueryPart implement
|
||||
}
|
||||
|
||||
public UDTImpl(String name, Schema schema, Package pkg) {
|
||||
this(name, schema, pkg, false);
|
||||
}
|
||||
|
||||
public UDTImpl(String name, Schema schema, Package pkg, boolean synthetic) {
|
||||
this.fields = new Fields<R>();
|
||||
this.name = name;
|
||||
this.schema = schema;
|
||||
this.pkg = pkg;
|
||||
this.synthetic = synthetic;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -176,6 +182,11 @@ public class UDTImpl<R extends UDTRecord<R>> extends AbstractQueryPart implement
|
||||
return pkg == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isSynthetic() {
|
||||
return synthetic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final R newRecord() {
|
||||
return DSL.using(new DefaultConfiguration()).newRecord(this);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user