Search in sources :

Example 6 with EmbeddableDefinition

use of org.jooq.meta.EmbeddableDefinition in project jOOQ by jOOQ.

the class JavaGenerator method generateEmbeddableInterfaces.

protected void generateEmbeddableInterfaces(SchemaDefinition schema) {
    log.info("Generating embeddable interfaces");
    for (EmbeddableDefinition embeddable : embeddables(schema)) {
        try {
            generateEmbeddableInterface(embeddable);
        } catch (Exception e) {
            log.error("Error while generating embeddable interface " + embeddable, e);
        }
    }
    watch.splitInfo("embeddable interfaces generated");
}
Also used : EmbeddableDefinition(org.jooq.meta.EmbeddableDefinition) IOException(java.io.IOException) SQLDialectNotSupportedException(org.jooq.exception.SQLDialectNotSupportedException) ReflectException(org.jooq.tools.reflect.ReflectException)

Example 7 with EmbeddableDefinition

use of org.jooq.meta.EmbeddableDefinition in project jOOQ by jOOQ.

the class JavaGenerator method generatePojo0.

private final void generatePojo0(Definition tableUdtOrEmbeddable, JavaWriter out) {
    final String className = getStrategy().getJavaClassName(tableUdtOrEmbeddable, Mode.POJO);
    final String interfaceName = generateInterfaces() ? out.ref(getStrategy().getFullJavaClassName(tableUdtOrEmbeddable, Mode.INTERFACE)) : "";
    final String superName = out.ref(getStrategy().getJavaClassExtends(tableUdtOrEmbeddable, Mode.POJO));
    final List<String> interfaces = out.ref(getStrategy().getJavaClassImplements(tableUdtOrEmbeddable, Mode.POJO));
    if (generateInterfaces())
        interfaces.add(interfaceName);
    final List<String> superTypes = list(superName, interfaces);
    printPackage(out, tableUdtOrEmbeddable, Mode.POJO);
    if (tableUdtOrEmbeddable instanceof TableDefinition)
        generatePojoClassJavadoc((TableDefinition) tableUdtOrEmbeddable, out);
    else if (tableUdtOrEmbeddable instanceof EmbeddableDefinition)
        generateEmbeddableClassJavadoc((EmbeddableDefinition) tableUdtOrEmbeddable, out);
    else
        generateUDTPojoClassJavadoc((UDTDefinition) tableUdtOrEmbeddable, out);
    printClassAnnotations(out, tableUdtOrEmbeddable, Mode.POJO);
    if (tableUdtOrEmbeddable instanceof TableDefinition)
        printTableJPAAnnotation(out, (TableDefinition) tableUdtOrEmbeddable);
    int maxLength0 = 0;
    for (TypedElementDefinition<?> column : getTypedElements(tableUdtOrEmbeddable)) maxLength0 = Math.max(maxLength0, out.ref(getJavaType(column.getType(resolver(out, Mode.POJO)), out, Mode.POJO)).length());
    int maxLength = maxLength0;
    if (scala) {
        out.println("%s%sclass %s(", visibility(), (generatePojosAsScalaCaseClasses() ? "case " : ""), className);
        forEach(getTypedElements(tableUdtOrEmbeddable), (column, separator) -> {
            out.println("%s%s %s: %s%s", visibility(generateInterfaces()), generateImmutablePojos() ? "val" : "var", scalaWhitespaceSuffix(getStrategy().getJavaMemberName(column, Mode.POJO)), out.ref(getJavaType(column.getType(resolver(out, Mode.POJO)), out, Mode.POJO)), separator);
        });
        out.println(")[[before= extends ][%s]][[before= with ][separator= with ][%s]] {", first(superTypes), remaining(superTypes));
    } else if (kotlin) {
        out.println("%s%sclass %s(", visibility(), (generatePojosAsKotlinDataClasses() ? "data " : ""), className);
        forEach(getTypedElements(tableUdtOrEmbeddable), (column, separator) -> {
            final String member = getStrategy().getJavaMemberName(column, Mode.POJO);
            if (column instanceof ColumnDefinition)
                printColumnJPAAnnotation(out, (ColumnDefinition) column);
            printValidationAnnotation(out, column);
            if (!generateImmutablePojos())
                printKotlinSetterAnnotation(out, column, Mode.POJO);
            out.println("%s%s%s %s: %s? = null%s", visibility(generateInterfaces()), generateInterfaces() ? "override " : "", generateImmutablePojos() ? "val" : "var", member, out.ref(getJavaType(column.getType(resolver(out, Mode.POJO)), out, Mode.POJO)), separator);
        });
        out.println(")[[before=: ][%s]] {", superTypes);
    } else {
        if (generatePojosAsJavaRecordClasses()) {
            out.println("%srecord %s(", visibility(), className);
            forEach(getTypedElements(tableUdtOrEmbeddable), (column, separator) -> {
                out.println("%s %s%s", StringUtils.rightPad(out.ref(getJavaType(column.getType(resolver(out, Mode.POJO)), out, Mode.POJO)), maxLength), getStrategy().getJavaMemberName(column, Mode.POJO), separator);
            });
            out.println(")[[before= implements ][%s]] {", interfaces);
        } else {
            out.println("%sclass %s[[before= extends ][%s]][[before= implements ][%s]] {", visibility(), className, list(superName), interfaces);
        }
        if (generateSerializablePojos() || generateSerializableInterfaces())
            out.printSerial();
        out.println();
        if (!generatePojosAsJavaRecordClasses())
            for (TypedElementDefinition<?> column : getTypedElements(tableUdtOrEmbeddable)) out.println("private %s%s %s;", generateImmutablePojos() ? "final " : "", StringUtils.rightPad(out.ref(getJavaType(column.getType(resolver(out, Mode.POJO)), out, Mode.POJO)), maxLength0), getStrategy().getJavaMemberName(column, Mode.POJO));
    }
    // Default constructor
    if (!generateImmutablePojos() && !generatePojosAsJavaRecordClasses())
        generatePojoDefaultConstructor(tableUdtOrEmbeddable, out);
    if (!kotlin) {
        if (!generatePojosAsJavaRecordClasses()) {
            // [#1363] [#7055] copy constructor
            generatePojoCopyConstructor(tableUdtOrEmbeddable, out);
            // Multi-constructor
            generatePojoMultiConstructor(tableUdtOrEmbeddable, out);
        }
        List<? extends TypedElementDefinition<?>> elements = getTypedElements(tableUdtOrEmbeddable);
        for (int i = 0; i < elements.size(); i++) {
            TypedElementDefinition<?> column = elements.get(i);
            if (!generatePojosAsJavaRecordClasses() || generateInterfaces())
                if (tableUdtOrEmbeddable instanceof TableDefinition)
                    generatePojoGetter(column, i, out);
                else
                    generateUDTPojoGetter(column, i, out);
            // Setter
            if (!generateImmutablePojos())
                if (tableUdtOrEmbeddable instanceof TableDefinition)
                    generatePojoSetter(column, i, out);
                else
                    generateUDTPojoSetter(column, i, out);
        }
    }
    if (tableUdtOrEmbeddable instanceof TableDefinition) {
        List<EmbeddableDefinition> embeddables = ((TableDefinition) tableUdtOrEmbeddable).getReferencedEmbeddables();
        for (int i = 0; i < embeddables.size(); i++) {
            EmbeddableDefinition embeddable = embeddables.get(i);
            if (!generateImmutablePojos())
                generateEmbeddablePojoSetter(embeddable, i, out);
            generateEmbeddablePojoGetter(embeddable, i, out);
        }
    }
    if (generatePojosEqualsAndHashCode())
        generatePojoEqualsAndHashCode(tableUdtOrEmbeddable, out);
    if (generatePojosToString())
        generatePojoToString(tableUdtOrEmbeddable, out);
    if (generateInterfaces() && !generateImmutablePojos())
        printFromAndInto(out, tableUdtOrEmbeddable, Mode.POJO);
    if (tableUdtOrEmbeddable instanceof TableDefinition)
        generatePojoClassFooter((TableDefinition) tableUdtOrEmbeddable, out);
    else if (tableUdtOrEmbeddable instanceof EmbeddableDefinition)
        generateEmbeddableClassFooter((EmbeddableDefinition) tableUdtOrEmbeddable, out);
    else
        generateUDTPojoClassFooter((UDTDefinition) tableUdtOrEmbeddable, out);
    out.println("}");
    closeJavaWriter(out);
}
Also used : RandomAccessFile(java.io.RandomAccessFile) Arrays(java.util.Arrays) TableRecordImpl(org.jooq.impl.TableRecordImpl) DSL(org.jooq.impl.DSL) SCALA(org.jooq.codegen.Language.SCALA) StringUtils.isBlank(org.jooq.tools.StringUtils.isBlank) Collectors.counting(java.util.stream.Collectors.counting) Internal(org.jooq.impl.Internal) POSTGRES(org.jooq.SQLDialect.POSTGRES) DatatypeConverter(jakarta.xml.bind.DatatypeConverter) AttributeDefinition(org.jooq.meta.AttributeDefinition) ColumnDefinition(org.jooq.meta.ColumnDefinition) RoutineDefinition(org.jooq.meta.RoutineDefinition) Matcher(java.util.regex.Matcher) IndexColumnDefinition(org.jooq.meta.IndexColumnDefinition) SelectField(org.jooq.SelectField) IdentityDefinition(org.jooq.meta.IdentityDefinition) Arrays.asList(java.util.Arrays.asList) Index(org.jooq.Index) Map(java.util.Map) BigInteger(java.math.BigInteger) SQLDialect(org.jooq.SQLDialect) Domain(org.jooq.Domain) Database(org.jooq.meta.Database) EmbeddableColumnDefinition(org.jooq.meta.EmbeddableColumnDefinition) CheckConstraintDefinition(org.jooq.meta.CheckConstraintDefinition) Set(java.util.Set) Constants(org.jooq.Constants) AggregateFunction(org.jooq.AggregateFunction) Result(org.jooq.Result) Collectors.joining(java.util.stream.Collectors.joining) GenerationOption(org.jooq.impl.QOM.GenerationOption) Stream(java.util.stream.Stream) TableField(org.jooq.TableField) SQLDataType(org.jooq.impl.SQLDataType) GeneratedAnnotationType(org.jooq.meta.jaxb.GeneratedAnnotationType) SequenceDefinition(org.jooq.meta.SequenceDefinition) Collectors.groupingBy(java.util.stream.Collectors.groupingBy) Parameter(org.jooq.Parameter) TableDefinition(org.jooq.meta.TableDefinition) CatalogImpl(org.jooq.impl.CatalogImpl) IndexDefinition(org.jooq.meta.IndexDefinition) Sequence(org.jooq.Sequence) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) Calendar(java.util.Calendar) Records(org.jooq.Records) Schema(org.jooq.Schema) BiConsumer(java.util.function.BiConsumer) RowId(org.jooq.RowId) LinkedHashSet(java.util.LinkedHashSet) MYSQL(org.jooq.SQLDialect.MYSQL) Record(org.jooq.Record) Mode(org.jooq.codegen.GeneratorStrategy.Mode) TypeVariable(java.lang.reflect.TypeVariable) IOException(java.io.IOException) StringUtils(org.jooq.tools.StringUtils) File(java.io.File) YUGABYTEDB(org.jooq.SQLDialect.YUGABYTEDB) VIRTUAL(org.jooq.impl.QOM.GenerationOption.VIRTUAL) SchemaDefinition(org.jooq.meta.SchemaDefinition) LazySupplier(org.jooq.impl.LazySupplier) TableImpl(org.jooq.impl.TableImpl) CatalogDefinition(org.jooq.meta.CatalogDefinition) UniqueKey(org.jooq.UniqueKey) Row(org.jooq.Row) IntStream.rangeClosed(java.util.stream.IntStream.rangeClosed) Time(java.sql.Time) Table(org.jooq.Table) DataTypeDefinition(org.jooq.meta.DataTypeDefinition) DAOImpl(org.jooq.impl.DAOImpl) PackageDefinition(org.jooq.meta.PackageDefinition) DefaultDataType(org.jooq.impl.DefaultDataType) UDT(org.jooq.UDT) PostgresDatabase(org.jooq.meta.postgres.PostgresDatabase) SortOrder(org.jooq.SortOrder) DataType(org.jooq.DataType) DSL.name(org.jooq.impl.DSL.name) IdentityHashMap(java.util.IdentityHashMap) JooqLogger(org.jooq.tools.JooqLogger) SQLDialectNotSupportedException(org.jooq.exception.SQLDialectNotSupportedException) Collections.nCopies(java.util.Collections.nCopies) TimeZone(java.util.TimeZone) Name(org.jooq.Name) Timestamp(java.sql.Timestamp) Collection(java.util.Collection) Check(org.jooq.Check) Field(org.jooq.Field) CloseResult(org.jooq.codegen.GeneratorWriter.CloseResult) PostgresRoutineDefinition(org.jooq.meta.postgres.PostgresRoutineDefinition) Collectors(java.util.stream.Collectors) UpdatableRecordImpl(org.jooq.impl.UpdatableRecordImpl) TypedElementDefinition(org.jooq.meta.TypedElementDefinition) JAVA(org.jooq.codegen.Language.JAVA) DomainDefinition(org.jooq.meta.DomainDefinition) Reflect(org.jooq.tools.reflect.Reflect) List(java.util.List) Modifier(java.lang.reflect.Modifier) Function.identity(java.util.function.Function.identity) Optional(java.util.Optional) Pattern(java.util.regex.Pattern) IntStream(java.util.stream.IntStream) UniqueKeyDefinition(org.jooq.meta.UniqueKeyDefinition) KOTLIN(org.jooq.codegen.Language.KOTLIN) UDTField(org.jooq.UDTField) DefaultDataTypeDefinition(org.jooq.meta.DefaultDataTypeDefinition) HashMap(java.util.HashMap) STORED(org.jooq.impl.QOM.GenerationOption.STORED) EnumType(org.jooq.EnumType) ForeignKey(org.jooq.ForeignKey) Function(java.util.function.Function) PackageImpl(org.jooq.impl.PackageImpl) Definition(org.jooq.meta.Definition) HashSet(java.util.HashSet) Identity(org.jooq.Identity) TableLike(org.jooq.TableLike) EmbeddableRecordImpl(org.jooq.impl.EmbeddableRecordImpl) EmbeddableDefinition(org.jooq.meta.EmbeddableDefinition) AbstractRoutine(org.jooq.impl.AbstractRoutine) Function2(org.jooq.Function2) ArrayDefinition(org.jooq.meta.ArrayDefinition) UDTDefinition(org.jooq.meta.UDTDefinition) AbstractTypedElementDefinition.getDataType(org.jooq.meta.AbstractTypedElementDefinition.getDataType) JavaTypeResolver(org.jooq.meta.JavaTypeResolver) ParameterDefinition(org.jooq.meta.ParameterDefinition) UDTRecordImpl(org.jooq.impl.UDTRecordImpl) ConstraintDefinition(org.jooq.meta.ConstraintDefinition) LazySchema(org.jooq.impl.LazySchema) DESC(org.jooq.SortOrder.DESC) SchemaImpl(org.jooq.impl.SchemaImpl) Date(java.sql.Date) ReflectException(org.jooq.tools.reflect.ReflectException) AbstractTypedElementDefinition(org.jooq.meta.AbstractTypedElementDefinition) Configuration(org.jooq.Configuration) Collectors.toList(java.util.stream.Collectors.toList) Catalog(org.jooq.Catalog) UDTImpl(org.jooq.impl.UDTImpl) StopWatch(org.jooq.tools.StopWatch) OrderField(org.jooq.OrderField) TableOptions(org.jooq.TableOptions) EnumDefinition(org.jooq.meta.EnumDefinition) ForeignKeyDefinition(org.jooq.meta.ForeignKeyDefinition) Collections(java.util.Collections) EmbeddableDefinition(org.jooq.meta.EmbeddableDefinition) TableDefinition(org.jooq.meta.TableDefinition) ColumnDefinition(org.jooq.meta.ColumnDefinition) IndexColumnDefinition(org.jooq.meta.IndexColumnDefinition) EmbeddableColumnDefinition(org.jooq.meta.EmbeddableColumnDefinition)

Example 8 with EmbeddableDefinition

use of org.jooq.meta.EmbeddableDefinition in project jOOQ by jOOQ.

the class JavaGenerator method generateRecord0.

private final void generateRecord0(Definition tableUdtOrEmbeddable, JavaWriter out) {
    final UniqueKeyDefinition key = (tableUdtOrEmbeddable instanceof TableDefinition) ? ((TableDefinition) tableUdtOrEmbeddable).getPrimaryKey() : null;
    final String className = getStrategy().getJavaClassName(tableUdtOrEmbeddable, Mode.RECORD);
    final String tableIdentifier = !(tableUdtOrEmbeddable instanceof EmbeddableDefinition) ? out.ref(getStrategy().getFullJavaIdentifier(tableUdtOrEmbeddable), 2) : null;
    final List<String> interfaces = out.ref(getStrategy().getJavaClassImplements(tableUdtOrEmbeddable, Mode.RECORD));
    printPackage(out, tableUdtOrEmbeddable, Mode.RECORD);
    if (tableUdtOrEmbeddable instanceof TableDefinition)
        generateRecordClassJavadoc((TableDefinition) tableUdtOrEmbeddable, out);
    else if (tableUdtOrEmbeddable instanceof EmbeddableDefinition)
        generateEmbeddableClassJavadoc((EmbeddableDefinition) tableUdtOrEmbeddable, out);
    else
        generateUDTRecordClassJavadoc((UDTDefinition) tableUdtOrEmbeddable, out);
    printClassAnnotations(out, tableUdtOrEmbeddable, Mode.RECORD);
    if (tableUdtOrEmbeddable instanceof TableDefinition)
        printTableJPAAnnotation(out, (TableDefinition) tableUdtOrEmbeddable);
    Class<?> baseClass;
    if (tableUdtOrEmbeddable instanceof UDTDefinition)
        baseClass = UDTRecordImpl.class;
    else if (tableUdtOrEmbeddable instanceof EmbeddableDefinition)
        baseClass = EmbeddableRecordImpl.class;
    else if (generateRelations() && key != null)
        baseClass = UpdatableRecordImpl.class;
    else
        baseClass = TableRecordImpl.class;
    // [#10481] Use the types from replaced embeddables if applicable
    List<Definition> embeddablesAndColumns = embeddablesAndColumns(tableUdtOrEmbeddable);
    List<Definition> embeddablesAndUnreplacedColumns = embeddablesAndUnreplacedColumns(tableUdtOrEmbeddable);
    List<Definition> replacingEmbeddablesAndUnreplacedColumns = replacingEmbeddablesAndUnreplacedColumns(tableUdtOrEmbeddable);
    List<Definition> embeddablesOrColumns = embeddablesOrColumns(tableUdtOrEmbeddable);
    int degree = replacingEmbeddablesAndUnreplacedColumns.size();
    String rowType = null;
    String rowTypeRecord = null;
    // [#6072] Generate these super types only if configured to do so
    if (generateRecordsImplementingRecordN() && degree > 0 && degree <= Constants.MAX_ROW_DEGREE) {
        rowType = refRowType(out, replacingEmbeddablesAndUnreplacedColumns);
        if (scala)
            rowTypeRecord = out.ref(Record.class.getName() + degree) + "[" + rowType + "]";
        else
            rowTypeRecord = out.ref(Record.class.getName() + degree) + "<" + rowType + ">";
        interfaces.add(rowTypeRecord);
    }
    if (generateInterfaces())
        interfaces.add(out.ref(getStrategy().getFullJavaClassName(tableUdtOrEmbeddable, Mode.INTERFACE)));
    if (scala)
        if (tableUdtOrEmbeddable instanceof EmbeddableDefinition)
            out.println("%sclass %s extends %s[%s](%s.%s.getDataType.getRow)[[before= with ][separator= with ][%s]] {", visibility(), className, baseClass, className, out.ref(getStrategy().getFullJavaIdentifier(((EmbeddableDefinition) tableUdtOrEmbeddable).getTable()), 2), getStrategy().getJavaIdentifier(tableUdtOrEmbeddable), interfaces);
        else
            out.println("%sclass %s extends %s[%s](%s)[[before= with ][separator= with ][%s]] {", visibility(), className, baseClass, className, tableIdentifier, interfaces);
    else if (kotlin)
        if (tableUdtOrEmbeddable instanceof EmbeddableDefinition)
            out.println("%sopen class %s() : %s<%s>(%s.%s.dataType.row)[[before=, ][%s]] {", visibility(), className, baseClass, className, out.ref(getStrategy().getFullJavaIdentifier(((EmbeddableDefinition) tableUdtOrEmbeddable).getTable()), 2), getStrategy().getJavaIdentifier(tableUdtOrEmbeddable), interfaces);
        else
            out.println("%sopen class %s() : %s<%s>(%s)[[before=, ][%s]] {", visibility(), className, baseClass, className, tableIdentifier, interfaces);
    else
        out.println("%sclass %s extends %s<%s>[[before= implements ][%s]] {", visibility(), className, baseClass, className, interfaces);
    out.printSerial();
    for (Definition column : embeddablesAndUnreplacedColumns) {
        final int index = replacingEmbeddablesAndUnreplacedColumns.indexOf(column);
        if (column instanceof EmbeddableDefinition) {
            final EmbeddableDefinition embeddable = (EmbeddableDefinition) column;
            generateEmbeddableRecordSetter(embeddable, index, out);
            generateEmbeddableRecordGetter(embeddable, index, out);
        } else {
            final TypedElementDefinition<?> c = (TypedElementDefinition<?>) column;
            if (tableUdtOrEmbeddable instanceof TableDefinition) {
                generateRecordSetter(c, index, out);
                generateRecordGetter(c, index, out);
            } else if (tableUdtOrEmbeddable instanceof EmbeddableDefinition) {
                generateEmbeddableSetter(c, index, out);
                generateEmbeddableGetter(c, index, out);
            } else {
                generateUDTRecordSetter(c, index, out);
                generateUDTRecordGetter(c, index, out);
            }
        }
    }
    if (generateRelations() && key != null) {
        int keyDegree = key.getKeyColumns().size();
        if (keyDegree <= Constants.MAX_ROW_DEGREE) {
            final String recordNType = out.ref(Record.class.getName() + keyDegree);
            final String keyType = refRowType(out, key.getKeyColumns());
            out.header("Primary key information");
            if (scala) {
                out.println();
                out.println("%soverride def key: %s[%s] = super.key.asInstanceOf[ %s[%s] ]", visibilityPublic(), recordNType, keyType, recordNType, keyType);
            } else if (kotlin) {
                out.println();
                out.println("%soverride fun key(): %s<%s> = super.key() as %s<%s>", visibilityPublic(), recordNType, keyType, recordNType, keyType);
            } else {
                out.overrideInherit();
                printNonnullAnnotation(out);
                out.println("%s%s<%s> key() {", visibilityPublic(), recordNType, keyType);
                out.println("return (%s) super.key();", recordNType);
                out.println("}");
            }
        }
    }
    if (tableUdtOrEmbeddable instanceof UDTDefinition) {
        // [#799] Oracle UDT's can have member procedures
        for (RoutineDefinition routine : ((UDTDefinition) tableUdtOrEmbeddable).getRoutines()) {
            // Instance methods ship with a SELF parameter at the first position
            // [#1584] Static methods don't have that
            boolean instance = routine.getInParameters().size() > 0 && routine.getInParameters().get(0).getInputName().toUpperCase(getStrategy().getTargetLocale()).equals("SELF");
            try {
                if (!routine.isSQLUsable()) {
                    // Instance execute() convenience method
                    printConvenienceMethodProcedure(out, routine, instance);
                } else {
                    // Instance execute() convenience method
                    if (!routine.isAggregate()) {
                        printConvenienceMethodFunction(out, routine, instance);
                    }
                }
            } catch (Exception e) {
                log.error("Error while generating routine " + routine, e);
            }
        }
    }
    // [#3130] Invalid UDTs may have a degree of 0
    if (generateRecordsImplementingRecordN() && degree > 0 && degree <= Constants.MAX_ROW_DEGREE) {
        final String recordNType = out.ref(Row.class.getName() + degree);
        out.header("Record%s type implementation", degree);
        // fieldsRow()
        if (scala) {
            out.println();
            out.println("%soverride def fieldsRow: %s[%s] = super.fieldsRow.asInstanceOf[ %s[%s] ]", visibilityPublic(), recordNType, rowType, recordNType, rowType);
        } else if (kotlin) {
            out.println();
            out.println("%soverride fun fieldsRow(): %s<%s> = super.fieldsRow() as %s<%s>", visibilityPublic(), recordNType, rowType, recordNType, rowType);
        } else {
            out.overrideInherit();
            printNonnullAnnotation(out);
            out.println("%s%s<%s> fieldsRow() {", visibilityPublic(), recordNType, rowType);
            out.println("return (%s) super.fieldsRow();", recordNType);
            out.println("}");
        }
        // valuesRow()
        if (scala) {
            out.println();
            out.println("%soverride def valuesRow: %s[%s] = super.valuesRow.asInstanceOf[ %s[%s] ]", visibilityPublic(), recordNType, rowType, recordNType, rowType);
        } else if (kotlin) {
            out.println("%soverride fun valuesRow(): %s<%s> = super.valuesRow() as %s<%s>", visibilityPublic(), recordNType, rowType, recordNType, rowType);
        } else {
            out.overrideInherit();
            printNonnullAnnotation(out);
            out.println("%s%s<%s> valuesRow() {", visibilityPublic(), recordNType, rowType);
            out.println("return (%s) super.valuesRow();", recordNType);
            out.println("}");
        }
        // field[N]()
        for (int i = 1; i <= degree; i++) {
            Definition column = replacingEmbeddablesAndUnreplacedColumns.get(i - 1);
            if (column instanceof EmbeddableColumnDefinition)
                column = ((EmbeddableColumnDefinition) column).getReferencingColumn();
            final String colTypeFull = getJavaType(column, out);
            final String colType = out.ref(colTypeFull);
            final String colIdentifierFull = out.ref(getStrategy().getFullJavaIdentifier(column), colRefSegments(column));
            final String colIdentifier = getStrategy().getJavaIdentifier(column);
            if (scala) {
                printDeprecationIfUnknownType(out, colTypeFull);
                if (tableUdtOrEmbeddable instanceof EmbeddableDefinition)
                    out.println("%soverride def field%s: %s[%s] = field(%s).asInstanceOf[%s [%s] ]", visibilityPublic(), i, Field.class, colType, i - 1, Field.class, colType);
                else
                    out.println("%soverride def field%s: %s[%s] = %s", visibilityPublic(), i, Field.class, colType, colIdentifierFull);
            } else if (kotlin) {
                printDeprecationIfUnknownType(out, colTypeFull);
                if (tableUdtOrEmbeddable instanceof EmbeddableDefinition)
                    out.println("%soverride fun field%s(): %s<%s?> = field(%s) as %s<%s?>", visibilityPublic(), i, Field.class, colType, i - 1, Field.class, colType);
                else if (tableUdtOrEmbeddable instanceof UDTDefinition)
                    out.println("%soverride fun field%s(): %s<%s%s> = %s.%s", visibilityPublic(), i, Field.class, colType, column instanceof EmbeddableDefinition ? "" : "?", out.ref(getStrategy().getFullJavaIdentifier(((AttributeDefinition) column).getContainer()), 2), colIdentifier);
                else
                    out.println("%soverride fun field%s(): %s<%s%s> = %s", visibilityPublic(), i, Field.class, colType, column instanceof EmbeddableDefinition ? "" : "?", colIdentifierFull);
            } else {
                if (printDeprecationIfUnknownType(out, colTypeFull))
                    out.override();
                else
                    out.overrideInherit();
                printNonnullAnnotation(out);
                out.println("%s%s<%s> field%s() {", visibilityPublic(), Field.class, colType, i);
                if (tableUdtOrEmbeddable instanceof EmbeddableDefinition)
                    out.println("return (%s<%s>) field(%s);", Field.class, colType, i - 1);
                else
                    out.println("return %s;", colIdentifierFull);
                out.println("}");
            }
        }
        // component[N]()
        for (int i = 1; i <= degree; i++) {
            Definition column = replacingEmbeddablesAndUnreplacedColumns.get(i - 1);
            final String colTypeFull = getJavaType(column, out);
            final String colType = out.ref(colTypeFull);
            final String colGetter = getStrategy().getJavaGetterName(column, Mode.RECORD);
            final String colMember = getStrategy().getJavaMemberName(column, Mode.POJO);
            if (scala) {
                printDeprecationIfUnknownType(out, colTypeFull);
                out.println("%soverride def component%s: %s = %s", visibilityPublic(), i, colType, colGetter);
            } else if (kotlin) {
                printDeprecationIfUnknownType(out, colTypeFull);
                out.println("%soverride fun component%s(): %s? = %s", visibilityPublic(), i, colType, colMember);
            } else {
                if (printDeprecationIfUnknownType(out, colTypeFull))
                    out.override();
                else
                    out.overrideInherit();
                printNullableOrNonnullAnnotation(out, column);
                out.println("%s%s component%s() {", visibilityPublic(), colType, i);
                out.println("return %s();", colGetter);
                out.println("}");
            }
        }
        // value[N]()
        for (int i = 1; i <= degree; i++) {
            Definition column = replacingEmbeddablesAndUnreplacedColumns.get(i - 1);
            final String colTypeFull = getJavaType(column, out);
            final String colType = out.ref(colTypeFull);
            final String colGetter = getStrategy().getJavaGetterName(column, Mode.RECORD);
            final String colMember = getStrategy().getJavaMemberName(column, Mode.POJO);
            if (scala) {
                printDeprecationIfUnknownType(out, colTypeFull);
                out.println("%soverride def value%s: %s = %s", visibilityPublic(), i, colType, colGetter);
            } else if (kotlin) {
                printDeprecationIfUnknownType(out, colTypeFull);
                out.println("%soverride fun value%s(): %s? = %s", visibilityPublic(), i, colType, colMember);
            } else {
                if (printDeprecationIfUnknownType(out, colTypeFull))
                    out.override();
                else
                    out.overrideInherit();
                printNullableOrNonnullAnnotation(out, column);
                out.println("%s%s value%s() {", visibilityPublic(), colType, i);
                out.println("return %s();", colGetter);
                out.println("}");
            }
        }
        // value[N](T[N])
        for (int i = 1; i <= degree; i++) {
            Definition column = replacingEmbeddablesAndUnreplacedColumns.get(i - 1);
            final String colTypeFull = getJavaType(column, out);
            final String colType = out.ref(colTypeFull);
            final String colSetter = getStrategy().getJavaSetterName(column, Mode.RECORD);
            final String colMember = getStrategy().getJavaMemberName(column, Mode.POJO);
            if (scala) {
                out.println();
                printDeprecationIfUnknownType(out, colTypeFull);
                out.println("%soverride def value%s(value: %s): %s = {", visibilityPublic(), i, colType, className);
                out.println("%s(value)", colSetter);
                out.println("this");
                out.println("}");
            } else if (kotlin) {
                out.println();
                printDeprecationIfUnknownType(out, colTypeFull);
                out.println("%soverride fun value%s(value: %s%s): %s {", visibilityPublic(), i, colType, column instanceof EmbeddableDefinition ? "" : "?", className);
                out.println("this.%s = value", colMember);
                out.println("return this");
                out.println("}");
            } else {
                final String nullableAnnotation = nullableOrNonnullAnnotation(out, column);
                if (printDeprecationIfUnknownType(out, colTypeFull))
                    out.override();
                else
                    out.overrideInherit();
                printNonnullAnnotation(out);
                out.println("%s%s value%s([[before=@][after= ][%s]]%s value) {", visibilityPublic(), className, i, list(nullableAnnotation), varargsIfArray(colType));
                out.println("%s(value);", colSetter);
                out.println("return this;");
                out.println("}");
            }
        }
        List<String> arguments = new ArrayList<>(degree);
        List<String> calls = new ArrayList<>(degree);
        for (int i = 1; i <= degree; i++) {
            final Definition column = replacingEmbeddablesAndUnreplacedColumns.get(i - 1);
            final String colType = getJavaTypeRef(column, out);
            if (scala) {
                arguments.add("value" + i + " : " + colType);
                calls.add("this.value" + i + "(value" + i + ")");
            } else if (kotlin) {
                arguments.add("value" + i + ": " + colType + (column instanceof EmbeddableDefinition ? "" : "?"));
                calls.add("this.value" + i + "(value" + i + ")");
            } else {
                final String nullableAnnotation = nullableOrNonnullAnnotation(out, column);
                arguments.add((nullableAnnotation == null ? "" : "@" + nullableAnnotation + " ") + colType + " value" + i);
                calls.add("value" + i + "(value" + i + ");");
            }
        }
        if (scala) {
            out.println();
            out.println("%soverride def values([[%s]]): %s = {", visibilityPublic(), arguments, className);
            for (String call : calls) out.println(call);
            out.println("this");
            out.println("}");
        } else if (kotlin) {
            out.println();
            out.println("%soverride fun values([[%s]]): %s {", visibilityPublic(), arguments, className);
            for (String call : calls) out.println(call);
            out.println("return this");
            out.println("}");
        } else {
            out.overrideInherit();
            printNonnullAnnotation(out);
            out.println("%s%s values([[%s]]) {", visibilityPublic(), className, arguments);
            for (String call : calls) out.println(call);
            out.println("return this;");
            out.println("}");
        }
    }
    if (generateInterfaces())
        printFromAndInto(out, tableUdtOrEmbeddable, Mode.RECORD);
    if (scala || kotlin) {
    } else {
        out.header("Constructors");
        out.javadoc("Create a detached %s", className);
        out.println("%s%s() {", visibility(), className);
        if (tableUdtOrEmbeddable instanceof EmbeddableDefinition)
            out.println("super(%s.%s.getDataType().getRow());", out.ref(getStrategy().getFullJavaIdentifier(((EmbeddableDefinition) tableUdtOrEmbeddable).getTable()), 2), getStrategy().getJavaIdentifier(tableUdtOrEmbeddable));
        else
            out.println("super(%s);", tableIdentifier);
        out.println("}");
    }
    // [#3130] Invalid UDTs may have a degree of 0
    // [#3176] Avoid generating constructors for tables with more than 255 columns (Java's method argument limit)
    generateRecordConstructor(tableUdtOrEmbeddable, out, replacingEmbeddablesAndUnreplacedColumns, false);
    if (!replacingEmbeddablesAndUnreplacedColumns.equals(embeddablesOrColumns))
        generateRecordConstructor(tableUdtOrEmbeddable, out, embeddablesOrColumns, false);
    if (generatePojos())
        generateRecordConstructor(tableUdtOrEmbeddable, out, replacingEmbeddablesAndUnreplacedColumns, true);
    if (tableUdtOrEmbeddable instanceof TableDefinition)
        generateRecordClassFooter((TableDefinition) tableUdtOrEmbeddable, out);
    else if (tableUdtOrEmbeddable instanceof EmbeddableDefinition)
        generateEmbeddableClassFooter((EmbeddableDefinition) tableUdtOrEmbeddable, out);
    else
        generateUDTRecordClassFooter((UDTDefinition) tableUdtOrEmbeddable, out);
    out.println("}");
}
Also used : UDTRecordImpl(org.jooq.impl.UDTRecordImpl) RoutineDefinition(org.jooq.meta.RoutineDefinition) PostgresRoutineDefinition(org.jooq.meta.postgres.PostgresRoutineDefinition) TypedElementDefinition(org.jooq.meta.TypedElementDefinition) AbstractTypedElementDefinition(org.jooq.meta.AbstractTypedElementDefinition) EmbeddableColumnDefinition(org.jooq.meta.EmbeddableColumnDefinition) UniqueKeyDefinition(org.jooq.meta.UniqueKeyDefinition) EmbeddableDefinition(org.jooq.meta.EmbeddableDefinition) TableRecordImpl(org.jooq.impl.TableRecordImpl) AttributeDefinition(org.jooq.meta.AttributeDefinition) ColumnDefinition(org.jooq.meta.ColumnDefinition) RoutineDefinition(org.jooq.meta.RoutineDefinition) IndexColumnDefinition(org.jooq.meta.IndexColumnDefinition) IdentityDefinition(org.jooq.meta.IdentityDefinition) EmbeddableColumnDefinition(org.jooq.meta.EmbeddableColumnDefinition) CheckConstraintDefinition(org.jooq.meta.CheckConstraintDefinition) SequenceDefinition(org.jooq.meta.SequenceDefinition) TableDefinition(org.jooq.meta.TableDefinition) IndexDefinition(org.jooq.meta.IndexDefinition) SchemaDefinition(org.jooq.meta.SchemaDefinition) CatalogDefinition(org.jooq.meta.CatalogDefinition) DataTypeDefinition(org.jooq.meta.DataTypeDefinition) PackageDefinition(org.jooq.meta.PackageDefinition) PostgresRoutineDefinition(org.jooq.meta.postgres.PostgresRoutineDefinition) TypedElementDefinition(org.jooq.meta.TypedElementDefinition) DomainDefinition(org.jooq.meta.DomainDefinition) UniqueKeyDefinition(org.jooq.meta.UniqueKeyDefinition) DefaultDataTypeDefinition(org.jooq.meta.DefaultDataTypeDefinition) Definition(org.jooq.meta.Definition) EmbeddableDefinition(org.jooq.meta.EmbeddableDefinition) ArrayDefinition(org.jooq.meta.ArrayDefinition) UDTDefinition(org.jooq.meta.UDTDefinition) ParameterDefinition(org.jooq.meta.ParameterDefinition) ConstraintDefinition(org.jooq.meta.ConstraintDefinition) AbstractTypedElementDefinition(org.jooq.meta.AbstractTypedElementDefinition) EnumDefinition(org.jooq.meta.EnumDefinition) ForeignKeyDefinition(org.jooq.meta.ForeignKeyDefinition) ArrayList(java.util.ArrayList) AttributeDefinition(org.jooq.meta.AttributeDefinition) UpdatableRecordImpl(org.jooq.impl.UpdatableRecordImpl) UDTDefinition(org.jooq.meta.UDTDefinition) IOException(java.io.IOException) SQLDialectNotSupportedException(org.jooq.exception.SQLDialectNotSupportedException) ReflectException(org.jooq.tools.reflect.ReflectException) SelectField(org.jooq.SelectField) TableField(org.jooq.TableField) Field(org.jooq.Field) UDTField(org.jooq.UDTField) OrderField(org.jooq.OrderField) TableDefinition(org.jooq.meta.TableDefinition) Record(org.jooq.Record)

Example 9 with EmbeddableDefinition

use of org.jooq.meta.EmbeddableDefinition in project jOOQ by jOOQ.

the class JavaGenerator method generateRecordConstructor.

private void generateRecordConstructor(Definition tableUdtOrEmbeddable, JavaWriter out, Collection<? extends Definition> columns, boolean pojoArgument) {
    if (pojoArgument && !generatePojos())
        return;
    final String className = getStrategy().getJavaClassName(tableUdtOrEmbeddable, Mode.RECORD);
    final String pojoNameFull = getStrategy().getFullJavaClassName(tableUdtOrEmbeddable, Mode.POJO);
    final String tableIdentifier = !(tableUdtOrEmbeddable instanceof EmbeddableDefinition) ? out.ref(getStrategy().getFullJavaIdentifier(tableUdtOrEmbeddable), 2) : null;
    final int degree = columns.size();
    // they can still have a pojoArgument constructor
    if (pojoArgument || degree > 0 && degree < 256) {
        List<String> arguments = new ArrayList<>(degree);
        List<String> properties = new ArrayList<>(degree);
        for (Definition column : columns) {
            final String columnMember = getStrategy().getJavaMemberName(column, Mode.DEFAULT);
            final String type = getJavaTypeRef(column, out);
            if (scala) {
                arguments.add(columnMember + " : " + type);
            } else if (kotlin) {
                arguments.add(columnMember + ": " + type + "? = null");
            } else {
                final String nullableAnnotation = column instanceof EmbeddableDefinition ? null : nullableOrNonnullAnnotation(out, column);
                arguments.add((nullableAnnotation == null ? "" : "@" + nullableAnnotation + " ") + type + " " + columnMember);
            }
            properties.add("\"" + escapeString(columnMember) + "\"");
        }
        out.javadoc("Create a detached, initialised %s", className);
        if (scala) {
            if (pojoArgument)
                out.println("%sdef this(value: %s) = {", visibility(), out.ref(pojoNameFull));
            else
                out.println("%sdef this([[%s]]) = {", visibility(), arguments);
            out.println("this()", tableIdentifier);
            out.println();
        } else if (kotlin) {
            if (pojoArgument)
                out.println("%sconstructor(value: %s?): this() {", visibility(), out.ref(pojoNameFull));
            else
                out.println("%sconstructor([[%s]]): this() {", visibility(), arguments);
        } else {
            if (generateConstructorPropertiesAnnotationOnRecords())
                out.println("@%s({ [[%s]] })", out.ref("java.beans.ConstructorProperties"), properties);
            if (pojoArgument)
                out.println("%s%s(%s value) {", visibility(), className, out.ref(pojoNameFull));
            else
                out.println("%s%s([[%s]]) {", visibility(), className, arguments);
            if (tableUdtOrEmbeddable instanceof EmbeddableDefinition)
                out.println("this();", tableIdentifier);
            else
                out.println("super(%s);", tableIdentifier);
            out.println();
        }
        if (pojoArgument && degree > 0)
            out.println("if (value != null) {");
        for (Definition column : columns) {
            if (column instanceof EmbeddableDefinition) {
                // TODO: Setters of X properties cannot accept X? in Kotlin: https://twitter.com/lukaseder/status/1296371561214234624
                if (kotlin)
                    if (pojoArgument)
                        out.println("this.%s = %s(%s) ?: %s([[%s]])", getStrategy().getJavaMemberName(column, Mode.POJO), out.ref(getStrategy().getFullJavaClassName(column, Mode.RECORD)), getStrategy().getJavaMemberName(column, Mode.POJO), out.ref(getStrategy().getFullJavaClassName(column, Mode.RECORD)), Collections.nCopies(((EmbeddableDefinition) column).getColumns().size(), "null"));
                    else
                        out.println("this.%s = %s ?: %s([[%s]])", getStrategy().getJavaMemberName(column, Mode.POJO), getStrategy().getJavaMemberName(column, Mode.POJO), out.ref(getStrategy().getFullJavaClassName(column, Mode.RECORD)), Collections.nCopies(((EmbeddableDefinition) column).getColumns().size(), "null"));
                else // In Scala, the setter call can be ambiguous, e.g. when using KeepNamesGeneratorStrategy
                if (scala)
                    if (pojoArgument)
                        out.println("this.%s(new %s(value.%s))", getStrategy().getJavaSetterName(column, Mode.RECORD), out.ref(getStrategy().getFullJavaClassName(column, Mode.RECORD)), getStrategy().getJavaGetterName(column, Mode.DEFAULT));
                    else
                        out.println("this.%s(%s)", getStrategy().getJavaSetterName(column, Mode.RECORD), getStrategy().getJavaMemberName(column, Mode.DEFAULT));
                else if (pojoArgument)
                    out.println("%s(new %s(value.%s()));", getStrategy().getJavaSetterName(column, Mode.RECORD), out.ref(getStrategy().getFullJavaClassName(column, Mode.RECORD)), generatePojosAsJavaRecordClasses() ? getStrategy().getJavaMemberName(column, Mode.POJO) : getStrategy().getJavaGetterName(column, Mode.DEFAULT));
                else
                    out.println("%s(%s);", getStrategy().getJavaSetterName(column, Mode.RECORD), getStrategy().getJavaMemberName(column, Mode.DEFAULT));
            } else {
                final TypedElementDefinition<?> t = (TypedElementDefinition<?>) column;
                final JavaTypeResolver r = resolver(out, Mode.RECORD);
                final boolean isUDT = t.getType(r).isUDT();
                final boolean isArray = t.getType(r).isArray();
                final boolean isUDTArray = t.getType(r).isUDTArray();
                final boolean isArrayOfUDTs = isArrayOfUDTs(t, r);
                final String udtType = (isUDT || isArray) ? out.ref(getJavaType(((TypedElementDefinition<?>) column).getType(r), out, Mode.RECORD)) : "";
                final String udtArrayElementType = isUDTArray ? out.ref(database.getArray(t.getType(r).getSchema(), t.getType(r).getQualifiedUserType()).getElementType(r).getJavaType(r)) : isArrayOfUDTs ? out.ref(getArrayBaseType(t.getType(r).getJavaType(r))) : "";
                if (kotlin) {
                    if (pojoArgument)
                        if (isUDTArray)
                            out.println("this.%s = value.%s?.let { %s(it.map { it?.let { %s(it) } }) }", getStrategy().getJavaMemberName(column, Mode.POJO), getStrategy().getJavaMemberName(column, Mode.POJO), udtType, udtArrayElementType);
                        else if (isArrayOfUDTs)
                            out.println("this.%s = value.%s?.let { it.map { it?.let { %s(it) } }.toTypedArray() }", getStrategy().getJavaMemberName(column, Mode.POJO), getStrategy().getJavaMemberName(column, Mode.POJO), udtArrayElementType);
                        else if (isUDT || isArray)
                            out.println("this.%s = value.%s?.let { %s(it) }", getStrategy().getJavaMemberName(column, Mode.POJO), getStrategy().getJavaMemberName(column, Mode.POJO), udtType);
                        else
                            out.println("this.%s = value.%s", getStrategy().getJavaMemberName(column, Mode.POJO), getStrategy().getJavaMemberName(column, Mode.POJO));
                    else
                        out.println("this.%s = %s", getStrategy().getJavaMemberName(column, Mode.POJO), getStrategy().getJavaMemberName(column, Mode.POJO));
                } else // In Scala, the setter call can be ambiguous, e.g. when using KeepNamesGeneratorStrategy
                if (scala) {
                    if (pojoArgument)
                        if (isUDTArray)
                            out.println("this.%s(if (value.%s == null) null else new %s(value.%s.stream().map { it => new %s(it) }.collect(%s.toList())))", getStrategy().getJavaSetterName(column, Mode.POJO), getStrategy().getJavaGetterName(column, Mode.POJO), udtType, getStrategy().getJavaGetterName(column, Mode.POJO), udtArrayElementType, Collectors.class);
                        else if (isArrayOfUDTs)
                            out.println("this.%s(if (value.%s == null) null else value.%s.map { it => new %s(it) })", getStrategy().getJavaSetterName(column, Mode.POJO), getStrategy().getJavaGetterName(column, Mode.POJO), getStrategy().getJavaGetterName(column, Mode.POJO), udtArrayElementType);
                        else if (isUDT || isArray)
                            out.println("this.%s(if (value.%s == null) null else new %s(value.%s))", getStrategy().getJavaSetterName(column, Mode.RECORD), getStrategy().getJavaGetterName(column, Mode.POJO), udtType, getStrategy().getJavaGetterName(column, Mode.POJO));
                        else
                            out.println("this.%s(value.%s)", getStrategy().getJavaSetterName(column, Mode.RECORD), getStrategy().getJavaGetterName(column, Mode.POJO));
                    else
                        out.println("this.%s(%s)", getStrategy().getJavaSetterName(column, Mode.RECORD), getStrategy().getJavaMemberName(column, Mode.POJO));
                } else {
                    if (pojoArgument)
                        if (isUDTArray)
                            out.println("%s(value.%s() == null ? null : new %s(value.%s().stream().map(%s::new).collect(%s.toList())));", getStrategy().getJavaSetterName(column, Mode.RECORD), getStrategy().getJavaGetterName(column, Mode.POJO), udtType, generatePojosAsJavaRecordClasses() ? getStrategy().getJavaMemberName(column, Mode.POJO) : getStrategy().getJavaGetterName(column, Mode.POJO), udtArrayElementType, Collectors.class);
                        else if (isArrayOfUDTs)
                            out.println("%s(value.%s() == null ? null : %s.of(value.%s()).map(%s::new).toArray(%s[]::new));", getStrategy().getJavaSetterName(column, Mode.RECORD), getStrategy().getJavaGetterName(column, Mode.POJO), Stream.class, generatePojosAsJavaRecordClasses() ? getStrategy().getJavaMemberName(column, Mode.POJO) : getStrategy().getJavaGetterName(column, Mode.POJO), udtArrayElementType, udtArrayElementType);
                        else if (isUDT || isArray)
                            out.println("%s(value.%s() == null ? null : new %s(value.%s()));", getStrategy().getJavaSetterName(column, Mode.RECORD), getStrategy().getJavaGetterName(column, Mode.POJO), udtType, generatePojosAsJavaRecordClasses() ? getStrategy().getJavaMemberName(column, Mode.POJO) : getStrategy().getJavaGetterName(column, Mode.POJO));
                        else
                            out.println("%s(value.%s());", getStrategy().getJavaSetterName(column, Mode.RECORD), generatePojosAsJavaRecordClasses() ? getStrategy().getJavaMemberName(column, Mode.POJO) : getStrategy().getJavaGetterName(column, Mode.POJO));
                    else
                        out.println("%s(%s);", getStrategy().getJavaSetterName(column, Mode.RECORD), getStrategy().getJavaMemberName(column, Mode.POJO));
                }
            }
        }
        if (pojoArgument && degree > 0)
            out.println("}");
        out.println("}");
    }
}
Also used : TypedElementDefinition(org.jooq.meta.TypedElementDefinition) AbstractTypedElementDefinition(org.jooq.meta.AbstractTypedElementDefinition) JavaTypeResolver(org.jooq.meta.JavaTypeResolver) Collectors(java.util.stream.Collectors) EmbeddableDefinition(org.jooq.meta.EmbeddableDefinition) ArrayList(java.util.ArrayList) AttributeDefinition(org.jooq.meta.AttributeDefinition) ColumnDefinition(org.jooq.meta.ColumnDefinition) RoutineDefinition(org.jooq.meta.RoutineDefinition) IndexColumnDefinition(org.jooq.meta.IndexColumnDefinition) IdentityDefinition(org.jooq.meta.IdentityDefinition) EmbeddableColumnDefinition(org.jooq.meta.EmbeddableColumnDefinition) CheckConstraintDefinition(org.jooq.meta.CheckConstraintDefinition) SequenceDefinition(org.jooq.meta.SequenceDefinition) TableDefinition(org.jooq.meta.TableDefinition) IndexDefinition(org.jooq.meta.IndexDefinition) SchemaDefinition(org.jooq.meta.SchemaDefinition) CatalogDefinition(org.jooq.meta.CatalogDefinition) DataTypeDefinition(org.jooq.meta.DataTypeDefinition) PackageDefinition(org.jooq.meta.PackageDefinition) PostgresRoutineDefinition(org.jooq.meta.postgres.PostgresRoutineDefinition) TypedElementDefinition(org.jooq.meta.TypedElementDefinition) DomainDefinition(org.jooq.meta.DomainDefinition) UniqueKeyDefinition(org.jooq.meta.UniqueKeyDefinition) DefaultDataTypeDefinition(org.jooq.meta.DefaultDataTypeDefinition) Definition(org.jooq.meta.Definition) EmbeddableDefinition(org.jooq.meta.EmbeddableDefinition) ArrayDefinition(org.jooq.meta.ArrayDefinition) UDTDefinition(org.jooq.meta.UDTDefinition) ParameterDefinition(org.jooq.meta.ParameterDefinition) ConstraintDefinition(org.jooq.meta.ConstraintDefinition) AbstractTypedElementDefinition(org.jooq.meta.AbstractTypedElementDefinition) EnumDefinition(org.jooq.meta.EnumDefinition) ForeignKeyDefinition(org.jooq.meta.ForeignKeyDefinition)

Aggregations

EmbeddableDefinition (org.jooq.meta.EmbeddableDefinition)9 IOException (java.io.IOException)7 SQLDialectNotSupportedException (org.jooq.exception.SQLDialectNotSupportedException)7 ReflectException (org.jooq.tools.reflect.ReflectException)7 TableDefinition (org.jooq.meta.TableDefinition)6 ArrayList (java.util.ArrayList)5 Collectors (java.util.stream.Collectors)4 File (java.io.File)3 RandomAccessFile (java.io.RandomAccessFile)3 HashSet (java.util.HashSet)3 LinkedHashSet (java.util.LinkedHashSet)3 AbstractTypedElementDefinition (org.jooq.meta.AbstractTypedElementDefinition)3 ArrayDefinition (org.jooq.meta.ArrayDefinition)3 AttributeDefinition (org.jooq.meta.AttributeDefinition)3 CatalogDefinition (org.jooq.meta.CatalogDefinition)3 CheckConstraintDefinition (org.jooq.meta.CheckConstraintDefinition)3 ColumnDefinition (org.jooq.meta.ColumnDefinition)3 ConstraintDefinition (org.jooq.meta.ConstraintDefinition)3 DataTypeDefinition (org.jooq.meta.DataTypeDefinition)3 DefaultDataTypeDefinition (org.jooq.meta.DefaultDataTypeDefinition)3