From 6f5ca2a7a274916ca4c459aa2ddcfb0ee2a30277 Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Mon, 22 Apr 2024 10:34:43 +0200 Subject: [PATCH] [jOOQ/jOOQ#16560] Cannot configure matchers using jOOQ-codegen-gradle plugin --- .../jooq/codegen/gradle/MetaExtensions.java | 258 +++++++++++++++ .../main/kotlin/org/jooq/kotlin/Extensions.kt | 14 + .../kotlin/org/jooq/meta/kotlin/Extensions.kt | 301 ++++++++++++++++++ 3 files changed, 573 insertions(+) diff --git a/jOOQ-codegen-gradle/src/main/java/org/jooq/codegen/gradle/MetaExtensions.java b/jOOQ-codegen-gradle/src/main/java/org/jooq/codegen/gradle/MetaExtensions.java index 793894d3ce..b8e86fa0e7 100644 --- a/jOOQ-codegen-gradle/src/main/java/org/jooq/codegen/gradle/MetaExtensions.java +++ b/jOOQ-codegen-gradle/src/main/java/org/jooq/codegen/gradle/MetaExtensions.java @@ -274,6 +274,12 @@ public class MetaExtensions { action.execute(o); setCatalogClass(o); } + + public void catalogIdentifier(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setCatalogIdentifier(o); + } } public static class MatcherRuleExtension extends MatcherRule { @@ -294,6 +300,18 @@ public class MetaExtensions { public MatchersSchemaTypeExtension(ObjectFactory objects) { this.objects = objects; } + + public void schemaClass(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setSchemaClass(o); + } + + public void schemaIdentifier(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setSchemaIdentifier(o); + } } public static class MatchersTableTypeExtension extends MatchersTableType { @@ -304,6 +322,60 @@ public class MetaExtensions { public MatchersTableTypeExtension(ObjectFactory objects) { this.objects = objects; } + + public void tableClass(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setTableClass(o); + } + + public void tableIdentifier(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setTableIdentifier(o); + } + + public void pathClass(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setPathClass(o); + } + + public void pathExtends(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setPathExtends(o); + } + + public void pathImplements(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setPathImplements(o); + } + + public void recordClass(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setRecordClass(o); + } + + public void interfaceClass(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setInterfaceClass(o); + } + + public void daoClass(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setDaoClass(o); + } + + public void pojoClass(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setPojoClass(o); + } } public static class MatchersIndexTypeExtension extends MatchersIndexType { @@ -314,6 +386,12 @@ public class MetaExtensions { public MatchersIndexTypeExtension(ObjectFactory objects) { this.objects = objects; } + + public void keyIdentifier(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setKeyIdentifier(o); + } } public static class MatchersPrimaryKeyTypeExtension extends MatchersPrimaryKeyType { @@ -324,6 +402,12 @@ public class MetaExtensions { public MatchersPrimaryKeyTypeExtension(ObjectFactory objects) { this.objects = objects; } + + public void keyIdentifier(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setKeyIdentifier(o); + } } public static class MatchersUniqueKeyTypeExtension extends MatchersUniqueKeyType { @@ -334,6 +418,12 @@ public class MetaExtensions { public MatchersUniqueKeyTypeExtension(ObjectFactory objects) { this.objects = objects; } + + public void keyIdentifier(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setKeyIdentifier(o); + } } public static class MatchersForeignKeyTypeExtension extends MatchersForeignKeyType { @@ -344,6 +434,30 @@ public class MetaExtensions { public MatchersForeignKeyTypeExtension(ObjectFactory objects) { this.objects = objects; } + + public void keyIdentifier(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setKeyIdentifier(o); + } + + public void pathMethodName(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setPathMethodName(o); + } + + public void pathMethodNameInverse(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setPathMethodNameInverse(o); + } + + public void pathMethodNameManyToMany(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setPathMethodNameManyToMany(o); + } } public static class MatchersFieldTypeExtension extends MatchersFieldType { @@ -354,6 +468,36 @@ public class MetaExtensions { public MatchersFieldTypeExtension(ObjectFactory objects) { this.objects = objects; } + + public void fieldIdentifier(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setFieldIdentifier(o); + } + + public void fieldMember(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setFieldMember(o); + } + + public void fieldSetter(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setFieldSetter(o); + } + + public void fieldGetter(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setFieldGetter(o); + } + + public void daoMember(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setDaoMember(o); + } } public static class MatchersRoutineTypeExtension extends MatchersRoutineType { @@ -364,6 +508,18 @@ public class MetaExtensions { public MatchersRoutineTypeExtension(ObjectFactory objects) { this.objects = objects; } + + public void routineClass(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setRoutineClass(o); + } + + public void routineMethod(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setRoutineMethod(o); + } } public static class MatchersSequenceTypeExtension extends MatchersSequenceType { @@ -374,6 +530,12 @@ public class MetaExtensions { public MatchersSequenceTypeExtension(ObjectFactory objects) { this.objects = objects; } + + public void sequenceIdentifier(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setSequenceIdentifier(o); + } } public static class MatchersEnumTypeExtension extends MatchersEnumType { @@ -384,6 +546,18 @@ public class MetaExtensions { public MatchersEnumTypeExtension(ObjectFactory objects) { this.objects = objects; } + + public void enumClass(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setEnumClass(o); + } + + public void enumLiteral(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setEnumLiteral(o); + } } public static class MatchersEmbeddableTypeExtension extends MatchersEmbeddableType { @@ -394,6 +568,24 @@ public class MetaExtensions { public MatchersEmbeddableTypeExtension(ObjectFactory objects) { this.objects = objects; } + + public void recordClass(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setRecordClass(o); + } + + public void interfaceClass(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setInterfaceClass(o); + } + + public void pojoClass(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setPojoClass(o); + } } public static class MatchersUDTTypeExtension extends MatchersUDTType { @@ -404,6 +596,42 @@ public class MetaExtensions { public MatchersUDTTypeExtension(ObjectFactory objects) { this.objects = objects; } + + public void udtClass(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setUdtClass(o); + } + + public void udtIdentifier(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setUdtIdentifier(o); + } + + public void pathClass(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setPathClass(o); + } + + public void recordClass(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setRecordClass(o); + } + + public void interfaceClass(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setInterfaceClass(o); + } + + public void pojoClass(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setPojoClass(o); + } } public static class MatchersAttributeTypeExtension extends MatchersAttributeType { @@ -414,6 +642,30 @@ public class MetaExtensions { public MatchersAttributeTypeExtension(ObjectFactory objects) { this.objects = objects; } + + public void attributeIdentifier(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setAttributeIdentifier(o); + } + + public void attributeMember(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setAttributeMember(o); + } + + public void attributeSetter(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setAttributeSetter(o); + } + + public void attributeGetter(Action action) { + MatcherRuleExtension o = objects.newInstance(MatcherRuleExtension.class, objects); + action.execute(o); + setAttributeGetter(o); + } } public static class DatabaseExtension extends Database { @@ -772,6 +1024,12 @@ public class MetaExtensions { public ForcedTypeExtension(ObjectFactory objects) { this.objects = objects; } + + public void lambdaConverter(Action action) { + LambdaConverterExtension o = objects.newInstance(LambdaConverterExtension.class, objects); + action.execute(o); + setLambdaConverter(o); + } } public static class GenerateExtension extends Generate { diff --git a/jOOQ-kotlin/src/main/kotlin/org/jooq/kotlin/Extensions.kt b/jOOQ-kotlin/src/main/kotlin/org/jooq/kotlin/Extensions.kt index e4e67a8ccf..c267af9ce1 100644 --- a/jOOQ-kotlin/src/main/kotlin/org/jooq/kotlin/Extensions.kt +++ b/jOOQ-kotlin/src/main/kotlin/org/jooq/kotlin/Extensions.kt @@ -553,6 +553,13 @@ fun Settings.migrationHistorySchema(block: MigrationSchema.() -> Unit) { block(migrationHistorySchema) } +fun Settings.migrationDefaultSchema(block: MigrationSchema.() -> Unit) { + if (migrationDefaultSchema == null) + migrationDefaultSchema = MigrationSchema() + + block(migrationDefaultSchema) +} + fun Settings.interpreterSearchPath(block: MutableList.() -> Unit) { block(interpreterSearchPath) } @@ -568,6 +575,13 @@ fun Settings.migrationSchemata(block: MutableList.() -> Unit) { block(migrationSchemata) } +@JvmName("mutableListMigrationSchema") +fun MutableList.migrationSchemata(block: MigrationSchema.() -> Unit) { + val e = MigrationSchema() + block(e) + add(e) +} + fun Settings.parseSearchPath(block: MutableList.() -> Unit) { block(parseSearchPath) } diff --git a/jOOQ-meta-kotlin/src/main/kotlin/org/jooq/meta/kotlin/Extensions.kt b/jOOQ-meta-kotlin/src/main/kotlin/org/jooq/meta/kotlin/Extensions.kt index 1660ba5d2b..e3ecfc560c 100644 --- a/jOOQ-meta-kotlin/src/main/kotlin/org/jooq/meta/kotlin/Extensions.kt +++ b/jOOQ-meta-kotlin/src/main/kotlin/org/jooq/meta/kotlin/Extensions.kt @@ -72,6 +72,13 @@ fun MatchersCatalogType.catalogClass(block: MatcherRule.() -> Unit) { block(catalogClass) } +fun MatchersCatalogType.catalogIdentifier(block: MatcherRule.() -> Unit) { + if (catalogIdentifier == null) + catalogIdentifier = MatcherRule() + + block(catalogIdentifier) +} + fun Matchers.schemas(block: MutableList.() -> Unit) { block(schemas) } @@ -83,6 +90,20 @@ fun MutableList.schema(block: MatchersSchemaType.() -> Unit) add(e) } +fun MatchersSchemaType.schemaClass(block: MatcherRule.() -> Unit) { + if (schemaClass == null) + schemaClass = MatcherRule() + + block(schemaClass) +} + +fun MatchersSchemaType.schemaIdentifier(block: MatcherRule.() -> Unit) { + if (schemaIdentifier == null) + schemaIdentifier = MatcherRule() + + block(schemaIdentifier) +} + fun Matchers.tables(block: MutableList.() -> Unit) { block(tables) } @@ -94,6 +115,69 @@ fun MutableList.table(block: MatchersTableType.() -> Unit) { add(e) } +fun MatchersTableType.tableClass(block: MatcherRule.() -> Unit) { + if (tableClass == null) + tableClass = MatcherRule() + + block(tableClass) +} + +fun MatchersTableType.tableIdentifier(block: MatcherRule.() -> Unit) { + if (tableIdentifier == null) + tableIdentifier = MatcherRule() + + block(tableIdentifier) +} + +fun MatchersTableType.pathClass(block: MatcherRule.() -> Unit) { + if (pathClass == null) + pathClass = MatcherRule() + + block(pathClass) +} + +fun MatchersTableType.pathExtends(block: MatcherRule.() -> Unit) { + if (pathExtends == null) + pathExtends = MatcherRule() + + block(pathExtends) +} + +fun MatchersTableType.pathImplements(block: MatcherRule.() -> Unit) { + if (pathImplements == null) + pathImplements = MatcherRule() + + block(pathImplements) +} + +fun MatchersTableType.recordClass(block: MatcherRule.() -> Unit) { + if (recordClass == null) + recordClass = MatcherRule() + + block(recordClass) +} + +fun MatchersTableType.interfaceClass(block: MatcherRule.() -> Unit) { + if (interfaceClass == null) + interfaceClass = MatcherRule() + + block(interfaceClass) +} + +fun MatchersTableType.daoClass(block: MatcherRule.() -> Unit) { + if (daoClass == null) + daoClass = MatcherRule() + + block(daoClass) +} + +fun MatchersTableType.pojoClass(block: MatcherRule.() -> Unit) { + if (pojoClass == null) + pojoClass = MatcherRule() + + block(pojoClass) +} + fun Matchers.indexes(block: MutableList.() -> Unit) { block(indexes) } @@ -105,6 +189,13 @@ fun MutableList.index(block: MatchersIndexType.() -> Unit) { add(e) } +fun MatchersIndexType.keyIdentifier(block: MatcherRule.() -> Unit) { + if (keyIdentifier == null) + keyIdentifier = MatcherRule() + + block(keyIdentifier) +} + fun Matchers.primaryKeys(block: MutableList.() -> Unit) { block(primaryKeys) } @@ -116,6 +207,13 @@ fun MutableList.primaryKey(block: MatchersPrimaryKeyType add(e) } +fun MatchersPrimaryKeyType.keyIdentifier(block: MatcherRule.() -> Unit) { + if (keyIdentifier == null) + keyIdentifier = MatcherRule() + + block(keyIdentifier) +} + fun Matchers.uniqueKeys(block: MutableList.() -> Unit) { block(uniqueKeys) } @@ -127,6 +225,13 @@ fun MutableList.uniqueKey(block: MatchersUniqueKeyType.() add(e) } +fun MatchersUniqueKeyType.keyIdentifier(block: MatcherRule.() -> Unit) { + if (keyIdentifier == null) + keyIdentifier = MatcherRule() + + block(keyIdentifier) +} + fun Matchers.foreignKeys(block: MutableList.() -> Unit) { block(foreignKeys) } @@ -138,6 +243,34 @@ fun MutableList.foreignKey(block: MatchersForeignKeyType add(e) } +fun MatchersForeignKeyType.keyIdentifier(block: MatcherRule.() -> Unit) { + if (keyIdentifier == null) + keyIdentifier = MatcherRule() + + block(keyIdentifier) +} + +fun MatchersForeignKeyType.pathMethodName(block: MatcherRule.() -> Unit) { + if (pathMethodName == null) + pathMethodName = MatcherRule() + + block(pathMethodName) +} + +fun MatchersForeignKeyType.pathMethodNameInverse(block: MatcherRule.() -> Unit) { + if (pathMethodNameInverse == null) + pathMethodNameInverse = MatcherRule() + + block(pathMethodNameInverse) +} + +fun MatchersForeignKeyType.pathMethodNameManyToMany(block: MatcherRule.() -> Unit) { + if (pathMethodNameManyToMany == null) + pathMethodNameManyToMany = MatcherRule() + + block(pathMethodNameManyToMany) +} + fun Matchers.fields(block: MutableList.() -> Unit) { block(fields) } @@ -149,6 +282,41 @@ fun MutableList.field(block: MatchersFieldType.() -> Unit) { add(e) } +fun MatchersFieldType.fieldIdentifier(block: MatcherRule.() -> Unit) { + if (fieldIdentifier == null) + fieldIdentifier = MatcherRule() + + block(fieldIdentifier) +} + +fun MatchersFieldType.fieldMember(block: MatcherRule.() -> Unit) { + if (fieldMember == null) + fieldMember = MatcherRule() + + block(fieldMember) +} + +fun MatchersFieldType.fieldSetter(block: MatcherRule.() -> Unit) { + if (fieldSetter == null) + fieldSetter = MatcherRule() + + block(fieldSetter) +} + +fun MatchersFieldType.fieldGetter(block: MatcherRule.() -> Unit) { + if (fieldGetter == null) + fieldGetter = MatcherRule() + + block(fieldGetter) +} + +fun MatchersFieldType.daoMember(block: MatcherRule.() -> Unit) { + if (daoMember == null) + daoMember = MatcherRule() + + block(daoMember) +} + fun Matchers.routines(block: MutableList.() -> Unit) { block(routines) } @@ -160,6 +328,20 @@ fun MutableList.routine(block: MatchersRoutineType.() -> Un add(e) } +fun MatchersRoutineType.routineClass(block: MatcherRule.() -> Unit) { + if (routineClass == null) + routineClass = MatcherRule() + + block(routineClass) +} + +fun MatchersRoutineType.routineMethod(block: MatcherRule.() -> Unit) { + if (routineMethod == null) + routineMethod = MatcherRule() + + block(routineMethod) +} + fun Matchers.sequences(block: MutableList.() -> Unit) { block(sequences) } @@ -171,6 +353,13 @@ fun MutableList.sequence(block: MatchersSequenceType.() -> add(e) } +fun MatchersSequenceType.sequenceIdentifier(block: MatcherRule.() -> Unit) { + if (sequenceIdentifier == null) + sequenceIdentifier = MatcherRule() + + block(sequenceIdentifier) +} + fun Matchers.enums(block: MutableList.() -> Unit) { block(enums) } @@ -182,6 +371,20 @@ fun MutableList.enum_(block: MatchersEnumType.() -> Unit) { add(e) } +fun MatchersEnumType.enumClass(block: MatcherRule.() -> Unit) { + if (enumClass == null) + enumClass = MatcherRule() + + block(enumClass) +} + +fun MatchersEnumType.enumLiteral(block: MatcherRule.() -> Unit) { + if (enumLiteral == null) + enumLiteral = MatcherRule() + + block(enumLiteral) +} + fun Matchers.embeddables(block: MutableList.() -> Unit) { block(embeddables) } @@ -193,6 +396,27 @@ fun MutableList.embeddable(block: MatchersEmbeddableType add(e) } +fun MatchersEmbeddableType.recordClass(block: MatcherRule.() -> Unit) { + if (recordClass == null) + recordClass = MatcherRule() + + block(recordClass) +} + +fun MatchersEmbeddableType.interfaceClass(block: MatcherRule.() -> Unit) { + if (interfaceClass == null) + interfaceClass = MatcherRule() + + block(interfaceClass) +} + +fun MatchersEmbeddableType.pojoClass(block: MatcherRule.() -> Unit) { + if (pojoClass == null) + pojoClass = MatcherRule() + + block(pojoClass) +} + fun Matchers.udts(block: MutableList.() -> Unit) { block(udts) } @@ -204,6 +428,48 @@ fun MutableList.udt(block: MatchersUDTType.() -> Unit) { add(e) } +fun MatchersUDTType.udtClass(block: MatcherRule.() -> Unit) { + if (udtClass == null) + udtClass = MatcherRule() + + block(udtClass) +} + +fun MatchersUDTType.udtIdentifier(block: MatcherRule.() -> Unit) { + if (udtIdentifier == null) + udtIdentifier = MatcherRule() + + block(udtIdentifier) +} + +fun MatchersUDTType.pathClass(block: MatcherRule.() -> Unit) { + if (pathClass == null) + pathClass = MatcherRule() + + block(pathClass) +} + +fun MatchersUDTType.recordClass(block: MatcherRule.() -> Unit) { + if (recordClass == null) + recordClass = MatcherRule() + + block(recordClass) +} + +fun MatchersUDTType.interfaceClass(block: MatcherRule.() -> Unit) { + if (interfaceClass == null) + interfaceClass = MatcherRule() + + block(interfaceClass) +} + +fun MatchersUDTType.pojoClass(block: MatcherRule.() -> Unit) { + if (pojoClass == null) + pojoClass = MatcherRule() + + block(pojoClass) +} + fun Matchers.attributes(block: MutableList.() -> Unit) { block(attributes) } @@ -215,6 +481,34 @@ fun MutableList.attribute(block: MatchersAttributeType.() add(e) } +fun MatchersAttributeType.attributeIdentifier(block: MatcherRule.() -> Unit) { + if (attributeIdentifier == null) + attributeIdentifier = MatcherRule() + + block(attributeIdentifier) +} + +fun MatchersAttributeType.attributeMember(block: MatcherRule.() -> Unit) { + if (attributeMember == null) + attributeMember = MatcherRule() + + block(attributeMember) +} + +fun MatchersAttributeType.attributeSetter(block: MatcherRule.() -> Unit) { + if (attributeSetter == null) + attributeSetter = MatcherRule() + + block(attributeSetter) +} + +fun MatchersAttributeType.attributeGetter(block: MatcherRule.() -> Unit) { + if (attributeGetter == null) + attributeGetter = MatcherRule() + + block(attributeGetter) +} + fun Generator.database(block: Database.() -> Unit) { if (database == null) database = Database() @@ -453,6 +747,13 @@ fun MutableList.forcedType(block: ForcedType.() -> Unit) { add(e) } +fun ForcedType.lambdaConverter(block: LambdaConverter.() -> Unit) { + if (lambdaConverter == null) + lambdaConverter = LambdaConverter() + + block(lambdaConverter) +} + fun Generator.generate(block: Generate.() -> Unit) { if (generate == null) generate = Generate()