Kotlin Meta Programming - Code Generation with Kotlin Poet
summary
Demonstrates generating real Kotlin source with Kotlin Poet, compiling and loading it to verify behavior, and wiring a Maven pipeline via a maven plugin for repeatable builds. Parses a JSON protocol to generate Kotlin data classes, provider interfaces and a QueryGateway extension, compiles them with kotlin-test-compile, and instantiates the generated class by reflection to show it runs. Recommends testing generators, caching by input hash to avoid repeated generation, and keeping generator API independent of the build integration.
AI-written summary · about
chapters (7)
- 0:00Kotlin meta programming intro
- 5:29Code generation importance
- 7:18Meta programming explained
- 11:56Kotlin Poet hello world
- 20:19Axon code generation
- 25:43Code generator best practices
- 29:12Optimizing generator performance
related talks
01h 00mKotlin Recipes
37mEffective Java with Groovy & Kotlin
53mKotlin Features Guaranteed to Surprise Java Developers
50mBootiful Kotlin
43mFunctional Programming in Java, Groovy, and Kotlin
46mPowering Compose Multiplatform Apps with Koog & MCP
54mKotlin DSLs as a Single Source of Truth for Multiple Tasks
52mSpring into Kotlin: How to Make the Magic even more Magical
