[jOOQ/jOOQ#9816] Add Definition.getSource()

This commit is contained in:
Lukas Eder 2020-02-10 13:00:44 +01:00
parent b0aab86afa
commit 04cfaaa329
2 changed files with 17 additions and 0 deletions

View File

@ -62,6 +62,7 @@ public abstract class AbstractDefinition implements Definition {
private final String name;
private final String comment;
private final String overload;
private final String source;
// [#2238] Some caches for strings that are heavy to calculate in large schemas
private transient String qualifiedInputName;
@ -83,6 +84,10 @@ public abstract class AbstractDefinition implements Definition {
}
public AbstractDefinition(Database database, SchemaDefinition schema, PackageDefinition pkg, String name, String comment, String overload) {
this(database, schema, pkg, name, comment, overload, null);
}
public AbstractDefinition(Database database, SchemaDefinition schema, PackageDefinition pkg, String name, String comment, String overload, String source) {
this.database = database;
// The subclass constructor cannot pass "this" to the super constructor
@ -93,6 +98,7 @@ public abstract class AbstractDefinition implements Definition {
this.name = name;
this.comment = comment;
this.overload = overload;
this.source = source;
}
@Override
@ -294,4 +300,9 @@ public abstract class AbstractDefinition implements Definition {
protected final SQLDialect getDialect() {
return database.getDialect();
}
@Override
public final String getSource() {
return source;
}
}

View File

@ -136,4 +136,10 @@ public interface Definition {
* @return The overload suffix if applicable
*/
String getOverload();
/**
* @return The source code of this object, if applicable, or
* <code>null</code>, if no such source code is available.
*/
String getSource();
}