using DSL outcome to generate Code
A GenRun operates on the GenCtx, which was populated inside a DslRun’s DslCtx
val examplesCodegenRun = GenRun(examplesDslRun.dslCtx.genCtx, examplesRunName)
examplesCodegenRun.start {
KotlinCodeGen(examplesCodegenRun).codeGen(MODELREFENUM.MODEL) // MODEL = ALL gen Subelements (DTO, DCO, TABLEFOR)
}
The GenCtx
contains the immutable result of a DslRun
in a “bite-sized” representation most suitable for code-generation.
Whilst performing code-generation a GenRun
reads information from the GenCtx
and might store/add information in its KotlinGenCtx
class GenCtxWrapper
wraps both to be neatly available to context(GenCtxWrapper)
classes and methods:
class GenCtxWrapper(val genCtx: GenCtx) {
val kotlinGenCtx = KotlinGenCtx._create()
}
implemented code generators
abstract class KotlinGenClassNonPersristent
- base class for e.g.
DTO
andDCO
, unrelated to persistent or other stuff (kind ofpojo
’s)
- base class for e.g.
abstract class KotlinGenExposedTable
- persistent table mapping generation (for Jetbrains Exposed db-framework)
abstract class AKotlinFiller
- base class for fillers (AND for persistent CRUD operations of
KotlinCrudExposed
)- KotlinFillerDto (nonPersistent stuff)
- KotlinFillerTable (persistent stuff) (for Jetbrains Exposed db-framework)
- base class for fillers (AND for persistent CRUD operations of
class KotlinCrudExposed
- CRUD (insert/select/update/delete) via Jetbrains Exposed db-framework
TODO codegen docs
maybe also some refactorings necessary…
how to get names from the strategies
sealed classes of codegen
etc. etc…