Skip to content

Commit

Permalink
Merge pull request #72 from SchwarzIT/feature/add-reduced-and-based-o…
Browse files Browse the repository at this point in the history
…n-interfaces-on-generated

# added reduced models and basedOn models resulting interfaces to gen…
  • Loading branch information
sbra0902 authored Apr 19, 2023
2 parents 5af1f27 + 3a9a62c commit 161a200
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class EntityGeneration {
.addModifiers(KModifier.PUBLIC)
.addSuperinterface(TypeUtil.iEntity())
.addSuperinterface(holder.interfaceTypeName)
.addSuperinterfaces(holder.collectAllChildInterfaces())
.addProperty(holder.dbNameProperty())
.addFunction(EnsureTypesGeneration.ensureTypes(holder, false))
.addFunction(CblDefaultGeneration.addDefaults(holder, false))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class WrapperGeneration {
.addSuperinterface(TypeUtil.mapSupport())
.addModifiers(KModifier.PUBLIC)
.addSuperinterface(holder.interfaceTypeName)
.addSuperinterfaces(holder.collectAllChildInterfaces())
.addFunction(EnsureTypesGeneration.ensureTypes(holder, true))
.addFunction(CblDefaultGeneration.addDefaults(holder, true))
.addFunction(CblConstantGeneration.addConstants(holder, true))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,10 @@ abstract class BaseEntityHolder(val sourceElement: ISourceModel) : IClassModel b

val interfaceTypeName: TypeName
get() = ClassName(sourcePackage, interfaceSimpleName)

fun collectAllChildInterfaces(): List<TypeName> {
val basedOnInterfaceTypeNames = basedOn.map { it.interfaceTypeName }
val reducesModelsInterfaceTypeNames = reducesModels.map { ClassName(sourcePackage, "I${it.namePrefix}$sourceClazzSimpleName") }
return listOf(*basedOnInterfaceTypeNames.toTypedArray(), *reducesModelsInterfaceTypeNames.toTypedArray())
}
}

0 comments on commit 161a200

Please sign in to comment.