[#937] In the event of name clash (same name for table and field) generated code has errors
[#953] Make DefaultGeneratorStrategy methods non-final to allow for overriding
This commit is contained in:
parent
f9721d8208
commit
b25421cbf4
@ -42,17 +42,12 @@ import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.TypeVariable;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
@ -107,14 +102,13 @@ import org.jooq.tools.StringUtils;
|
||||
*/
|
||||
public class DefaultGenerator implements Generator {
|
||||
|
||||
private static final JooqLogger log = JooqLogger.getLogger(DefaultGenerator.class);
|
||||
private static final Map<Class<?>, Set<String>> reservedColumns = new HashMap<Class<?>, Set<String>>();
|
||||
private static String version;
|
||||
private static final JooqLogger log = JooqLogger.getLogger(DefaultGenerator.class);
|
||||
private static String version;
|
||||
|
||||
private boolean generateDeprecated = true;
|
||||
private boolean generateRelations = false;
|
||||
private boolean generateInstanceFields = true;
|
||||
private GeneratorStrategy strategy;
|
||||
private boolean generateDeprecated = true;
|
||||
private boolean generateRelations = false;
|
||||
private boolean generateInstanceFields = true;
|
||||
private GeneratorStrategy strategy;
|
||||
|
||||
@Override
|
||||
public void setStrategy(GeneratorStrategy strategy) {
|
||||
@ -452,7 +446,7 @@ public class DefaultGenerator implements Generator {
|
||||
|
||||
// Getters
|
||||
for (ColumnDefinition column : columns) {
|
||||
printFieldJavaDoc(out, "", column);
|
||||
printFieldJavaDoc(out, column);
|
||||
out.print("\tpublic final ");
|
||||
out.print(data.getField(column.getName()).getType());
|
||||
out.print(" get");
|
||||
@ -892,13 +886,10 @@ public class DefaultGenerator implements Generator {
|
||||
|
||||
Class<?> baseClass;
|
||||
|
||||
Set<String> reserved;
|
||||
if (generateRelations() && table.getMainUniqueKey() != null) {
|
||||
baseClass = UpdatableRecordImpl.class;
|
||||
reserved = reservedColumns(UpdatableRecordImpl.class);
|
||||
} else {
|
||||
baseClass = TableRecordImpl.class;
|
||||
reserved = reservedColumns(TableRecordImpl.class);
|
||||
}
|
||||
|
||||
out.print("public class ");
|
||||
@ -911,7 +902,7 @@ public class DefaultGenerator implements Generator {
|
||||
out.printSerial();
|
||||
|
||||
for (ColumnDefinition column : table.getColumns()) {
|
||||
printGetterAndSetter(out, column, table, reserved);
|
||||
printGetterAndSetter(out, column);
|
||||
}
|
||||
|
||||
out.println();
|
||||
@ -1021,12 +1012,11 @@ public class DefaultGenerator implements Generator {
|
||||
out.print(strategy.getFullJavaClassName(udt, "Record"));
|
||||
out.println("> {");
|
||||
|
||||
Set<String> reserved = reservedColumns(UDTRecordImpl.class);
|
||||
out.printSerial();
|
||||
out.println();
|
||||
|
||||
for (AttributeDefinition attribute : udt.getAttributes()) {
|
||||
printGetterAndSetter(out, attribute, udt, reserved);
|
||||
printGetterAndSetter(out, attribute);
|
||||
}
|
||||
|
||||
out.println();
|
||||
@ -1371,40 +1361,6 @@ public class DefaultGenerator implements Generator {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find all column names that are reserved because of the extended
|
||||
* class hierarchy of a generated class
|
||||
*
|
||||
* @see <a href="https://sourceforge.net/apps/trac/jooq/ticket/182">https://sourceforge.net/apps/trac/jooq/ticket/182</a>
|
||||
*/
|
||||
private Set<String> reservedColumns(Class<?> clazz) {
|
||||
if (clazz == null) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
Set<String> result = reservedColumns.get(clazz);
|
||||
|
||||
if (result == null) {
|
||||
result = new HashSet<String>();
|
||||
reservedColumns.put(clazz, result);
|
||||
|
||||
result.addAll(reservedColumns(clazz.getSuperclass()));
|
||||
for (Class<?> c : clazz.getInterfaces()) {
|
||||
result.addAll(reservedColumns(c));
|
||||
}
|
||||
|
||||
for (Method m : clazz.getDeclaredMethods()) {
|
||||
String name = m.getName();
|
||||
|
||||
if (name.startsWith("get") && m.getParameterTypes().length == 0) {
|
||||
result.add(name.substring(3));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void printRoutine(Database database, SchemaDefinition schema, RoutineDefinition routine)
|
||||
throws FileNotFoundException, SQLException {
|
||||
strategy.getFile(routine).getParentFile().mkdirs();
|
||||
@ -1414,18 +1370,10 @@ public class DefaultGenerator implements Generator {
|
||||
printHeader(out, strategy.getJavaPackageName(routine));
|
||||
printClassJavadoc(out, routine);
|
||||
|
||||
Class<?> procedureClass = AbstractRoutine.class;
|
||||
// if (database.getDialect() == SQLDialect.POSTGRES &&
|
||||
// routine.getOutParameters().size() == 1 &&
|
||||
// routine.getOutParameters().get(0).getType().isUDT()) {
|
||||
//
|
||||
// procedureClass = PostgresSingleUDTOutParameterProcedure.class;
|
||||
// }
|
||||
|
||||
out.print("public class ");
|
||||
out.print(strategy.getJavaClassName(routine));
|
||||
out.print(" extends ");
|
||||
out.print(procedureClass);
|
||||
out.print(AbstractRoutine.class);
|
||||
out.print("<");
|
||||
|
||||
if (routine.getReturnValue() == null) {
|
||||
@ -1864,25 +1812,14 @@ public class DefaultGenerator implements Generator {
|
||||
}
|
||||
}
|
||||
|
||||
private void printGetterAndSetter(GenerationWriter out, TypedElementDefinition<?> element, Definition type, Set<String> reserved) throws SQLException {
|
||||
String columnDisambiguationSuffix = "";
|
||||
String getterDisambiguationSuffix = "";
|
||||
|
||||
if (strategy.getJavaIdentifierUC(element).equals(strategy.getJavaIdentifierUC(type))) {
|
||||
columnDisambiguationSuffix = "_";
|
||||
}
|
||||
|
||||
if (reserved.contains(strategy.getJavaClassName(element))) {
|
||||
getterDisambiguationSuffix = "_";
|
||||
}
|
||||
|
||||
printFieldJavaDoc(out, getterDisambiguationSuffix, element);
|
||||
out.println("\tpublic void set" + strategy.getJavaClassName(element) + getterDisambiguationSuffix + "(" + getJavaType(element.getType()) + " value) {");
|
||||
out.println("\t\tsetValue(" + strategy.getFullJavaIdentifierUC(element) + columnDisambiguationSuffix + ", value);");
|
||||
private void printGetterAndSetter(GenerationWriter out, TypedElementDefinition<?> element) throws SQLException {
|
||||
printFieldJavaDoc(out, element);
|
||||
out.println("\tpublic void " + strategy.getJavaSetterName(element) + "(" + getJavaType(element.getType()) + " value) {");
|
||||
out.println("\t\tsetValue(" + strategy.getFullJavaIdentifierUC(element) + ", value);");
|
||||
out.println("\t}");
|
||||
printFieldJavaDoc(out, getterDisambiguationSuffix, element);
|
||||
out.println("\tpublic " + getJavaType(element.getType()) + " get" + strategy.getJavaClassName(element) + getterDisambiguationSuffix + "() {");
|
||||
out.println("\t\treturn getValue(" + strategy.getFullJavaIdentifierUC(element) + columnDisambiguationSuffix + ");");
|
||||
printFieldJavaDoc(out, element);
|
||||
out.println("\tpublic " + getJavaType(element.getType()) + " " + strategy.getJavaGetterName(element) + "() {");
|
||||
out.println("\t\treturn getValue(" + strategy.getFullJavaIdentifierUC(element) + ");");
|
||||
out.println("\t}");
|
||||
|
||||
if (generateRelations() && element instanceof ColumnDefinition) {
|
||||
@ -1911,7 +1848,7 @@ public class DefaultGenerator implements Generator {
|
||||
|
||||
TableDefinition referencing = foreignKey.getKeyTable();
|
||||
|
||||
printFieldJavaDoc(out, null, column);
|
||||
printFieldJavaDoc(out, column);
|
||||
out.print("\tpublic ");
|
||||
out.print(List.class);
|
||||
out.print("<");
|
||||
@ -1988,7 +1925,7 @@ public class DefaultGenerator implements Generator {
|
||||
}
|
||||
|
||||
if (!skipGeneration) {
|
||||
printFieldJavaDoc(out, null, column);
|
||||
printFieldJavaDoc(out, column);
|
||||
out.print("\tpublic ");
|
||||
out.print(strategy.getFullJavaClassName(referenced, "Record"));
|
||||
out.print(" fetch");
|
||||
@ -2052,9 +1989,7 @@ public class DefaultGenerator implements Generator {
|
||||
}
|
||||
|
||||
private void printColumnDefinition(GenerationWriter out, TypedElementDefinition<?> column, Definition type, Class<?> declaredMemberClass) throws SQLException {
|
||||
String columnDisambiguationSuffix =
|
||||
strategy.getJavaIdentifierUC(column).equals(strategy.getJavaIdentifierUC(type)) ? "_" : "";
|
||||
printFieldJavaDoc(out, columnDisambiguationSuffix, column);
|
||||
printFieldJavaDoc(out, column);
|
||||
|
||||
boolean hasType =
|
||||
type instanceof TableDefinition ||
|
||||
@ -2082,7 +2017,6 @@ public class DefaultGenerator implements Generator {
|
||||
out.print(getJavaType(column.getType()));
|
||||
out.print("> ");
|
||||
out.print(strategy.getJavaIdentifierUC(column));
|
||||
out.print(columnDisambiguationSuffix);
|
||||
|
||||
if (declaredMemberClass == TableField.class) {
|
||||
out.print(" = createField");
|
||||
@ -2116,11 +2050,11 @@ public class DefaultGenerator implements Generator {
|
||||
out.println(");");
|
||||
}
|
||||
|
||||
private void printFieldJavaDoc(GenerationWriter out, String disambiguationSuffix, TypedElementDefinition<?> element) throws SQLException {
|
||||
printFieldJavaDoc(out, disambiguationSuffix, element, null);
|
||||
private void printFieldJavaDoc(GenerationWriter out, TypedElementDefinition<?> element) throws SQLException {
|
||||
printFieldJavaDoc(out, element, null);
|
||||
}
|
||||
|
||||
private void printFieldJavaDoc(GenerationWriter out, String disambiguationSuffix, TypedElementDefinition<?> element, String deprecation) throws SQLException {
|
||||
private void printFieldJavaDoc(GenerationWriter out, TypedElementDefinition<?> element, String deprecation) throws SQLException {
|
||||
out.println();
|
||||
out.println("\t/**");
|
||||
|
||||
@ -2172,10 +2106,11 @@ public class DefaultGenerator implements Generator {
|
||||
}
|
||||
}
|
||||
|
||||
if (disambiguationSuffix != null && disambiguationSuffix.length() > 0) {
|
||||
out.println("\t * ");
|
||||
out.println("\t * This item causes a name clash. That is why an underline character was appended to the Java field name");
|
||||
}
|
||||
// TODO Log this!
|
||||
// if (disambiguationSuffix != null && disambiguationSuffix.length() > 0) {
|
||||
// out.println("\t * ");
|
||||
// out.println("\t * This item causes a name clash. That is why an underline character was appended to the Java field name");
|
||||
// }
|
||||
|
||||
printDeprecation(out, deprecation);
|
||||
|
||||
|
||||
@ -36,7 +36,16 @@
|
||||
package org.jooq.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jooq.impl.TableRecordImpl;
|
||||
import org.jooq.impl.UDTRecordImpl;
|
||||
import org.jooq.impl.UpdatableRecordImpl;
|
||||
import org.jooq.tools.StringUtils;
|
||||
|
||||
/**
|
||||
@ -47,15 +56,17 @@ import org.jooq.tools.StringUtils;
|
||||
@SuppressWarnings("unused")
|
||||
public class DefaultGeneratorStrategy implements GeneratorStrategy {
|
||||
|
||||
private String targetDirectory;
|
||||
private String targetPackage;
|
||||
private String tableClassPrefix;
|
||||
private String tableClassSuffix;
|
||||
private String recordClassPrefix;
|
||||
private String recordClassSuffix;
|
||||
private String scheme;
|
||||
private final Map<Class<?>, Set<String>> reservedColumns = new HashMap<Class<?>, Set<String>>();
|
||||
|
||||
private boolean instanceFields;
|
||||
private String targetDirectory;
|
||||
private String targetPackage;
|
||||
private String tableClassPrefix;
|
||||
private String tableClassSuffix;
|
||||
private String recordClassPrefix;
|
||||
private String recordClassSuffix;
|
||||
private String scheme;
|
||||
|
||||
private boolean instanceFields;
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Initialisation
|
||||
@ -92,22 +103,22 @@ public class DefaultGeneratorStrategy implements GeneratorStrategy {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getTargetDirectory() {
|
||||
public String getTargetDirectory() {
|
||||
return targetDirectory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setTargetDirectory(String directory) {
|
||||
public void setTargetDirectory(String directory) {
|
||||
this.targetDirectory = directory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getTargetPackage() {
|
||||
public String getTargetPackage() {
|
||||
return targetPackage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setTargetPackage(String packageName) {
|
||||
public void setTargetPackage(String packageName) {
|
||||
this.targetPackage = packageName;
|
||||
}
|
||||
|
||||
@ -116,54 +127,70 @@ public class DefaultGeneratorStrategy implements GeneratorStrategy {
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public final String getFileName(Definition definition) {
|
||||
public String getFileName(Definition definition) {
|
||||
return getJavaClassName(definition) + ".java";
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getFileName(Definition definition, String suffix) {
|
||||
public String getFileName(Definition definition, String suffix) {
|
||||
return getJavaClassName(definition) + suffix + ".java";
|
||||
}
|
||||
|
||||
@Override
|
||||
public final File getFile(Definition definition) {
|
||||
public File getFile(Definition definition) {
|
||||
return getFile(definition, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public final File getFile(Definition definition, String suffix) {
|
||||
public File getFile(Definition definition, String suffix) {
|
||||
String dir = getTargetDirectory();
|
||||
String pkg = getJavaPackageName(definition, suffix).replaceAll("\\.", "/");
|
||||
return new File(dir + "/" + pkg, getFileName(definition, suffix));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getJavaIdentifier(Definition definition) {
|
||||
public String getJavaIdentifier(Definition definition) {
|
||||
return GenerationUtil.convertToJavaIdentifier(definition.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getJavaIdentifierUC(Definition definition) {
|
||||
return getJavaIdentifier(definition).toUpperCase();
|
||||
public String getJavaIdentifierUC(Definition definition) {
|
||||
String identifier = getJavaIdentifier(definition).toUpperCase();
|
||||
|
||||
// Columns, Attributes, Parameters
|
||||
if (definition instanceof ColumnDefinition ||
|
||||
definition instanceof AttributeDefinition) {
|
||||
|
||||
TypedElementDefinition<?> e = (TypedElementDefinition<?>) definition;
|
||||
|
||||
if (identifier.equals(getJavaIdentifierUC(e.getContainer()))) {
|
||||
return identifier + "_";
|
||||
}
|
||||
}
|
||||
|
||||
return identifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getFullJavaIdentifierUC(Definition definition) {
|
||||
public String getFullJavaIdentifierUC(Definition definition) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
// Columns
|
||||
if (definition instanceof ColumnDefinition) {
|
||||
TypedElementDefinition<?> e = (TypedElementDefinition<?>) definition;
|
||||
|
||||
if (instanceFields) {
|
||||
sb.append(getFullJavaIdentifierUC(((TypedElementDefinition<?>) definition).getContainer()));
|
||||
sb.append(getFullJavaIdentifierUC(e.getContainer()));
|
||||
}
|
||||
else {
|
||||
sb.append(getFullJavaClassName(((TypedElementDefinition<?>) definition).getContainer()));
|
||||
sb.append(getFullJavaClassName(e.getContainer()));
|
||||
}
|
||||
}
|
||||
|
||||
// Attributes, Parameters
|
||||
else if (definition instanceof TypedElementDefinition) {
|
||||
sb.append(getFullJavaClassName(((TypedElementDefinition<?>) definition).getContainer()));
|
||||
TypedElementDefinition<?> e = (TypedElementDefinition<?>) definition;
|
||||
sb.append(getFullJavaClassName(e.getContainer()));
|
||||
}
|
||||
|
||||
// Table, UDT, Schema, etc
|
||||
@ -178,22 +205,92 @@ public class DefaultGeneratorStrategy implements GeneratorStrategy {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getJavaClassName(Definition definition) {
|
||||
public String getJavaSetterName(Definition definition) {
|
||||
return "set" + disambiguateMethod(definition, getJavaClassName(definition));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJavaGetterName(Definition definition) {
|
||||
return "get" + disambiguateMethod(definition, getJavaClassName(definition));
|
||||
}
|
||||
|
||||
/**
|
||||
* [#182] Method name disambiguation is important to avoid name clashes due
|
||||
* to pre-existing getters / setters in super classes
|
||||
*/
|
||||
private String disambiguateMethod(Definition definition, String javaClassName) {
|
||||
Set<String> reserved = null;
|
||||
|
||||
if (definition instanceof AttributeDefinition) {
|
||||
reserved = reservedColumns(UDTRecordImpl.class);
|
||||
}
|
||||
else if (definition instanceof ColumnDefinition) {
|
||||
if (((ColumnDefinition) definition).getContainer().getMainUniqueKey() != null) {
|
||||
reserved = reservedColumns(UpdatableRecordImpl.class);
|
||||
}
|
||||
else {
|
||||
reserved = reservedColumns(TableRecordImpl.class);
|
||||
}
|
||||
}
|
||||
|
||||
if (reserved != null && reserved.contains(javaClassName)) {
|
||||
return javaClassName + "_";
|
||||
}
|
||||
|
||||
return javaClassName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [#182] Find all column names that are reserved because of the extended
|
||||
* class hierarchy of a generated class
|
||||
*/
|
||||
private Set<String> reservedColumns(Class<?> clazz) {
|
||||
if (clazz == null) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
Set<String> result = reservedColumns.get(clazz);
|
||||
|
||||
if (result == null) {
|
||||
result = new HashSet<String>();
|
||||
reservedColumns.put(clazz, result);
|
||||
|
||||
// Recurse up in class hierarchy
|
||||
result.addAll(reservedColumns(clazz.getSuperclass()));
|
||||
for (Class<?> c : clazz.getInterfaces()) {
|
||||
result.addAll(reservedColumns(c));
|
||||
}
|
||||
|
||||
for (Method m : clazz.getDeclaredMethods()) {
|
||||
String name = m.getName();
|
||||
|
||||
if (name.startsWith("get") && m.getParameterTypes().length == 0) {
|
||||
result.add(name.substring(3));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJavaClassName(Definition definition) {
|
||||
return getJavaClassName(definition, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getJavaClassName(Definition definition, String suffix) {
|
||||
public String getJavaClassName(Definition definition, String suffix) {
|
||||
return getJavaClassName0(definition, suffix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getJavaPackageName(Definition definition) {
|
||||
public String getJavaPackageName(Definition definition) {
|
||||
return getJavaPackageName(definition, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getJavaPackageName(Definition definition, String suffix) {
|
||||
public String getJavaPackageName(Definition definition, String suffix) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append(getTargetPackage());
|
||||
@ -211,18 +308,18 @@ public class DefaultGeneratorStrategy implements GeneratorStrategy {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getJavaClassNameLC(Definition definition) {
|
||||
public String getJavaClassNameLC(Definition definition) {
|
||||
return getJavaClassNameLC(definition, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getJavaClassNameLC(Definition definition, String suffix) {
|
||||
public String getJavaClassNameLC(Definition definition, String suffix) {
|
||||
String result = getJavaClassName0(definition, suffix);
|
||||
|
||||
return result.substring(0, 1).toLowerCase() + result.substring(1);
|
||||
}
|
||||
|
||||
private final String getJavaClassName0(Definition definition, String suffix) {
|
||||
private String getJavaClassName0(Definition definition, String suffix) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
|
||||
String name = GenerationUtil.convertToJavaIdentifier(definition.getName());
|
||||
@ -240,12 +337,12 @@ public class DefaultGeneratorStrategy implements GeneratorStrategy {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getFullJavaClassName(Definition definition) {
|
||||
public String getFullJavaClassName(Definition definition) {
|
||||
return getFullJavaClassName(definition, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getFullJavaClassName(Definition definition, String suffix) {
|
||||
public String getFullJavaClassName(Definition definition, String suffix) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append(getJavaPackageName(definition, suffix));
|
||||
@ -256,7 +353,7 @@ public class DefaultGeneratorStrategy implements GeneratorStrategy {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getSubPackage(Definition definition) {
|
||||
public String getSubPackage(Definition definition) {
|
||||
if (definition instanceof MasterDataTableDefinition) {
|
||||
return "enums";
|
||||
}
|
||||
|
||||
@ -82,6 +82,18 @@ public interface GeneratorStrategy {
|
||||
*/
|
||||
String getFullJavaIdentifierUC(Definition definition);
|
||||
|
||||
/**
|
||||
* @return The Java setter method name representing this object, e.g.
|
||||
* [setMyTable]
|
||||
*/
|
||||
String getJavaSetterName(Definition definition);
|
||||
|
||||
/**
|
||||
* @return The Java getter method name representing this object, e.g.
|
||||
* [getMyTable]
|
||||
*/
|
||||
String getJavaGetterName(Definition definition);
|
||||
|
||||
/**
|
||||
* @return The Java class name representing this object, e.g. [MyTable]
|
||||
*/
|
||||
|
||||
@ -46,6 +46,10 @@ DROP TABLE IF EXISTS t_658_22/
|
||||
DROP TABLE IF EXISTS t_658_32/
|
||||
DROP TABLE IF EXISTS t_725_lob_test/
|
||||
DROP TABLE IF EXISTS t_785/
|
||||
DROP TABLE IF EXISTS T_937/
|
||||
DROP TABLE IF EXISTS "T_941"/
|
||||
DROP TABLE IF EXISTS "t_941"/
|
||||
DROP TABLE IF EXISTS T_943/
|
||||
DROP TABLE IF EXISTS system/
|
||||
DROP TABLE IF EXISTS class/
|
||||
DROP TABLE IF EXISTS integer/
|
||||
@ -167,6 +171,13 @@ CREATE TABLE t_785 (
|
||||
)
|
||||
/
|
||||
|
||||
CREATE TABLE T_937 (
|
||||
T_937 int,
|
||||
|
||||
CONSTRAINT T_937 PRIMARY KEY (T_937)
|
||||
)
|
||||
/
|
||||
|
||||
CREATE TABLE t_author (
|
||||
ID INT,
|
||||
FIRST_NAME VARCHAR(50),
|
||||
|
||||
@ -19,6 +19,7 @@ public class Keys extends org.jooq.impl.AbstractKeys {
|
||||
// UNIQUE and PRIMARY KEY definitions
|
||||
public static final org.jooq.UniqueKey<org.jooq.test.hsqldb.generatedclasses.tables.records.T_639NumbersTableRecord> PK_T_639_NUMBERS_TABLE = createUniqueKey(org.jooq.test.hsqldb.generatedclasses.tables.T_639NumbersTable.T_639_NUMBERS_TABLE, org.jooq.test.hsqldb.generatedclasses.tables.T_639NumbersTable.T_639_NUMBERS_TABLE.ID);
|
||||
public static final org.jooq.UniqueKey<org.jooq.test.hsqldb.generatedclasses.tables.records.T_725LobTestRecord> PK_T_725_LOB_TEST = createUniqueKey(org.jooq.test.hsqldb.generatedclasses.tables.T_725LobTest.T_725_LOB_TEST, org.jooq.test.hsqldb.generatedclasses.tables.T_725LobTest.T_725_LOB_TEST.ID);
|
||||
public static final org.jooq.UniqueKey<org.jooq.test.hsqldb.generatedclasses.tables.records.T_937Record> T_937 = createUniqueKey(org.jooq.test.hsqldb.generatedclasses.tables.T_937.T_937, org.jooq.test.hsqldb.generatedclasses.tables.T_937.T_937.T_937_);
|
||||
public static final org.jooq.UniqueKey<org.jooq.test.hsqldb.generatedclasses.tables.records.TArraysRecord> PK_T_ARRAYS = createUniqueKey(org.jooq.test.hsqldb.generatedclasses.tables.TArrays.T_ARRAYS, org.jooq.test.hsqldb.generatedclasses.tables.TArrays.T_ARRAYS.ID);
|
||||
public static final org.jooq.UniqueKey<org.jooq.test.hsqldb.generatedclasses.tables.records.TAuthorRecord> PK_T_AUTHOR = createUniqueKey(org.jooq.test.hsqldb.generatedclasses.tables.TAuthor.T_AUTHOR, org.jooq.test.hsqldb.generatedclasses.tables.TAuthor.T_AUTHOR.ID);
|
||||
public static final org.jooq.UniqueKey<org.jooq.test.hsqldb.generatedclasses.tables.records.TBookRecord> PK_T_BOOK = createUniqueKey(org.jooq.test.hsqldb.generatedclasses.tables.TBook.T_BOOK, org.jooq.test.hsqldb.generatedclasses.tables.TBook.T_BOOK.ID);
|
||||
|
||||
@ -10,7 +10,7 @@ package org.jooq.test.hsqldb.generatedclasses;
|
||||
comments = "This class is generated by jOOQ")
|
||||
public class Public extends org.jooq.impl.SchemaImpl {
|
||||
|
||||
private static final long serialVersionUID = -984901630;
|
||||
private static final long serialVersionUID = 1783690052;
|
||||
|
||||
/**
|
||||
* The singleton instance of PUBLIC
|
||||
@ -43,6 +43,7 @@ public class Public extends org.jooq.impl.SchemaImpl {
|
||||
org.jooq.test.hsqldb.generatedclasses.tables.T_658Ref.T_658_REF,
|
||||
org.jooq.test.hsqldb.generatedclasses.tables.T_725LobTest.T_725_LOB_TEST,
|
||||
org.jooq.test.hsqldb.generatedclasses.tables.T_785.T_785,
|
||||
org.jooq.test.hsqldb.generatedclasses.tables.T_937.T_937,
|
||||
org.jooq.test.hsqldb.generatedclasses.tables.TArrays.T_ARRAYS,
|
||||
org.jooq.test.hsqldb.generatedclasses.tables.TAuthor.T_AUTHOR,
|
||||
org.jooq.test.hsqldb.generatedclasses.tables.TBook.T_BOOK,
|
||||
|
||||
@ -67,6 +67,11 @@ public final class Tables {
|
||||
*/
|
||||
public static org.jooq.test.hsqldb.generatedclasses.tables.T_785 T_785 = org.jooq.test.hsqldb.generatedclasses.tables.T_785.T_785;
|
||||
|
||||
/**
|
||||
* The table PUBLIC.T_937
|
||||
*/
|
||||
public static org.jooq.test.hsqldb.generatedclasses.tables.T_937 T_937 = org.jooq.test.hsqldb.generatedclasses.tables.T_937.T_937;
|
||||
|
||||
/**
|
||||
* The table PUBLIC.T_ARRAYS
|
||||
*/
|
||||
|
||||
@ -10,7 +10,7 @@ package org.jooq.test.hsqldb.generatedclasses.tables;
|
||||
comments = "This class is generated by jOOQ")
|
||||
public class Class extends org.jooq.impl.TableImpl<org.jooq.test.hsqldb.generatedclasses.tables.records.ClassRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1032818879;
|
||||
private static final long serialVersionUID = -1526438879;
|
||||
|
||||
/**
|
||||
* The singleton instance of CLASS
|
||||
@ -32,8 +32,6 @@ public class Class extends org.jooq.impl.TableImpl<org.jooq.test.hsqldb.generate
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*
|
||||
* This item causes a name clash. That is why an underline character was appended to the Java field name
|
||||
*/
|
||||
public final org.jooq.TableField<org.jooq.test.hsqldb.generatedclasses.tables.records.ClassRecord, java.lang.Integer> CLASS_ = createField("CLASS", org.jooq.impl.SQLDataType.INTEGER, this);
|
||||
|
||||
|
||||
@ -0,0 +1,69 @@
|
||||
/**
|
||||
* This class is generated by jOOQ
|
||||
*/
|
||||
package org.jooq.test.hsqldb.generatedclasses.tables;
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@javax.annotation.Generated(value = {"http://www.jooq.org", "2.0.0"},
|
||||
comments = "This class is generated by jOOQ")
|
||||
public class T_937 extends org.jooq.impl.UpdatableTableImpl<org.jooq.test.hsqldb.generatedclasses.tables.records.T_937Record> {
|
||||
|
||||
private static final long serialVersionUID = 1451777996;
|
||||
|
||||
/**
|
||||
* The singleton instance of T_937
|
||||
*/
|
||||
public static final org.jooq.test.hsqldb.generatedclasses.tables.T_937 T_937 = new org.jooq.test.hsqldb.generatedclasses.tables.T_937();
|
||||
|
||||
/**
|
||||
* The class holding records for this type
|
||||
*/
|
||||
private static final java.lang.Class<org.jooq.test.hsqldb.generatedclasses.tables.records.T_937Record> __RECORD_TYPE = org.jooq.test.hsqldb.generatedclasses.tables.records.T_937Record.class;
|
||||
|
||||
/**
|
||||
* The class holding records for this type
|
||||
*/
|
||||
@Override
|
||||
public java.lang.Class<org.jooq.test.hsqldb.generatedclasses.tables.records.T_937Record> getRecordType() {
|
||||
return __RECORD_TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*
|
||||
* PRIMARY KEY
|
||||
*/
|
||||
public final org.jooq.TableField<org.jooq.test.hsqldb.generatedclasses.tables.records.T_937Record, java.lang.Integer> T_937_ = createField("T_937", org.jooq.impl.SQLDataType.INTEGER, this);
|
||||
|
||||
/**
|
||||
* No further instances allowed
|
||||
*/
|
||||
private T_937() {
|
||||
super("T_937", org.jooq.test.hsqldb.generatedclasses.Public.PUBLIC);
|
||||
}
|
||||
|
||||
/**
|
||||
* No further instances allowed
|
||||
*/
|
||||
private T_937(java.lang.String alias) {
|
||||
super(alias, org.jooq.test.hsqldb.generatedclasses.Public.PUBLIC, org.jooq.test.hsqldb.generatedclasses.tables.T_937.T_937);
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.jooq.UniqueKey<org.jooq.test.hsqldb.generatedclasses.tables.records.T_937Record> getMainKey() {
|
||||
return org.jooq.test.hsqldb.generatedclasses.Keys.T_937;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public java.util.List<org.jooq.UniqueKey<org.jooq.test.hsqldb.generatedclasses.tables.records.T_937Record>> getKeys() {
|
||||
return java.util.Arrays.<org.jooq.UniqueKey<org.jooq.test.hsqldb.generatedclasses.tables.records.T_937Record>>asList(org.jooq.test.hsqldb.generatedclasses.Keys.T_937);
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.jooq.test.hsqldb.generatedclasses.tables.T_937 as(java.lang.String alias) {
|
||||
return new org.jooq.test.hsqldb.generatedclasses.tables.T_937(alias);
|
||||
}
|
||||
}
|
||||
@ -10,12 +10,10 @@ package org.jooq.test.hsqldb.generatedclasses.tables.records;
|
||||
comments = "This class is generated by jOOQ")
|
||||
public class ClassRecord extends org.jooq.impl.TableRecordImpl<org.jooq.test.hsqldb.generatedclasses.tables.records.ClassRecord> {
|
||||
|
||||
private static final long serialVersionUID = -1390368568;
|
||||
private static final long serialVersionUID = -109971452;
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*
|
||||
* This item causes a name clash. That is why an underline character was appended to the Java field name
|
||||
*/
|
||||
public void setClass_(java.lang.Integer value) {
|
||||
setValue(org.jooq.test.hsqldb.generatedclasses.tables.Class.CLASS.CLASS_, value);
|
||||
@ -23,8 +21,6 @@ public class ClassRecord extends org.jooq.impl.TableRecordImpl<org.jooq.test.hsq
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*
|
||||
* This item causes a name clash. That is why an underline character was appended to the Java field name
|
||||
*/
|
||||
public java.lang.Integer getClass_() {
|
||||
return getValue(org.jooq.test.hsqldb.generatedclasses.tables.Class.CLASS.CLASS_);
|
||||
|
||||
@ -0,0 +1,39 @@
|
||||
/**
|
||||
* This class is generated by jOOQ
|
||||
*/
|
||||
package org.jooq.test.hsqldb.generatedclasses.tables.records;
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@javax.annotation.Generated(value = {"http://www.jooq.org", "2.0.0"},
|
||||
comments = "This class is generated by jOOQ")
|
||||
public class T_937Record extends org.jooq.impl.UpdatableRecordImpl<org.jooq.test.hsqldb.generatedclasses.tables.records.T_937Record> {
|
||||
|
||||
private static final long serialVersionUID = -1543129734;
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*
|
||||
* PRIMARY KEY
|
||||
*/
|
||||
public void setT_937(java.lang.Integer value) {
|
||||
setValue(org.jooq.test.hsqldb.generatedclasses.tables.T_937.T_937.T_937_, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*
|
||||
* PRIMARY KEY
|
||||
*/
|
||||
public java.lang.Integer getT_937() {
|
||||
return getValue(org.jooq.test.hsqldb.generatedclasses.tables.T_937.T_937.T_937_);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a detached T_937Record
|
||||
*/
|
||||
public T_937Record() {
|
||||
super(org.jooq.test.hsqldb.generatedclasses.tables.T_937.T_937);
|
||||
}
|
||||
}
|
||||
@ -10,7 +10,7 @@ package org.jooq.test.hsqldb.generatedclasses.tables.records;
|
||||
comments = "This class is generated by jOOQ")
|
||||
public class XUnusedRecord extends org.jooq.impl.UpdatableRecordImpl<org.jooq.test.hsqldb.generatedclasses.tables.records.XUnusedRecord> {
|
||||
|
||||
private static final long serialVersionUID = -2031616123;
|
||||
private static final long serialVersionUID = 1174741343;
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
@ -142,8 +142,6 @@ public class XUnusedRecord extends org.jooq.impl.UpdatableRecordImpl<org.jooq.te
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*
|
||||
* This item causes a name clash. That is why an underline character was appended to the Java field name
|
||||
*/
|
||||
public void setClass_(java.lang.Integer value) {
|
||||
setValue(org.jooq.test.hsqldb.generatedclasses.tables.XUnused.X_UNUSED.CLASS, value);
|
||||
@ -151,8 +149,6 @@ public class XUnusedRecord extends org.jooq.impl.UpdatableRecordImpl<org.jooq.te
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*
|
||||
* This item causes a name clash. That is why an underline character was appended to the Java field name
|
||||
*/
|
||||
public java.lang.Integer getClass_() {
|
||||
return getValue(org.jooq.test.hsqldb.generatedclasses.tables.XUnused.X_UNUSED.CLASS);
|
||||
@ -160,8 +156,6 @@ public class XUnusedRecord extends org.jooq.impl.UpdatableRecordImpl<org.jooq.te
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*
|
||||
* This item causes a name clash. That is why an underline character was appended to the Java field name
|
||||
*/
|
||||
public void setFields_(java.lang.Integer value) {
|
||||
setValue(org.jooq.test.hsqldb.generatedclasses.tables.XUnused.X_UNUSED.FIELDS, value);
|
||||
@ -169,8 +163,6 @@ public class XUnusedRecord extends org.jooq.impl.UpdatableRecordImpl<org.jooq.te
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*
|
||||
* This item causes a name clash. That is why an underline character was appended to the Java field name
|
||||
*/
|
||||
public java.lang.Integer getFields_() {
|
||||
return getValue(org.jooq.test.hsqldb.generatedclasses.tables.XUnused.X_UNUSED.FIELDS);
|
||||
@ -178,8 +170,6 @@ public class XUnusedRecord extends org.jooq.impl.UpdatableRecordImpl<org.jooq.te
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*
|
||||
* This item causes a name clash. That is why an underline character was appended to the Java field name
|
||||
*/
|
||||
public void setConfiguration_(java.lang.Integer value) {
|
||||
setValue(org.jooq.test.hsqldb.generatedclasses.tables.XUnused.X_UNUSED.CONFIGURATION, value);
|
||||
@ -187,8 +177,6 @@ public class XUnusedRecord extends org.jooq.impl.UpdatableRecordImpl<org.jooq.te
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*
|
||||
* This item causes a name clash. That is why an underline character was appended to the Java field name
|
||||
*/
|
||||
public java.lang.Integer getConfiguration_() {
|
||||
return getValue(org.jooq.test.hsqldb.generatedclasses.tables.XUnused.X_UNUSED.CONFIGURATION);
|
||||
@ -210,8 +198,6 @@ public class XUnusedRecord extends org.jooq.impl.UpdatableRecordImpl<org.jooq.te
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*
|
||||
* This item causes a name clash. That is why an underline character was appended to the Java field name
|
||||
*/
|
||||
public void setMetaData_(java.lang.Integer value) {
|
||||
setValue(org.jooq.test.hsqldb.generatedclasses.tables.XUnused.X_UNUSED.META_DATA, value);
|
||||
@ -219,8 +205,6 @@ public class XUnusedRecord extends org.jooq.impl.UpdatableRecordImpl<org.jooq.te
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*
|
||||
* This item causes a name clash. That is why an underline character was appended to the Java field name
|
||||
*/
|
||||
public java.lang.Integer getMetaData_() {
|
||||
return getValue(org.jooq.test.hsqldb.generatedclasses.tables.XUnused.X_UNUSED.META_DATA);
|
||||
@ -228,8 +212,6 @@ public class XUnusedRecord extends org.jooq.impl.UpdatableRecordImpl<org.jooq.te
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*
|
||||
* This item causes a name clash. That is why an underline character was appended to the Java field name
|
||||
*/
|
||||
public void setType0_(java.lang.Integer value) {
|
||||
setValue(org.jooq.test.hsqldb.generatedclasses.tables.XUnused.X_UNUSED.TYPE0, value);
|
||||
@ -237,8 +219,6 @@ public class XUnusedRecord extends org.jooq.impl.UpdatableRecordImpl<org.jooq.te
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*
|
||||
* This item causes a name clash. That is why an underline character was appended to the Java field name
|
||||
*/
|
||||
public java.lang.Integer getType0_() {
|
||||
return getValue(org.jooq.test.hsqldb.generatedclasses.tables.XUnused.X_UNUSED.TYPE0);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user