Intro to CodeBlock
What is it?
The code block is a class that let's you generate code that acts instead of constructs. In other words, it's the place where you can place if
. This is inside a function, but also in the initialization of properties. This is nothing different from KotlinPoet.
The goal of KotlinPoetDSL
The goal of KotlinPoetDSL with these code-blocks is to make the control-flows as much build in as possible. Build in and tested features means you won't write mistakes when you have to write them yourselves.
Generating
The codeBlock can both be generated implicitly and explicitly
Implicit generation
The codeBlock is implicitly build with alll the functions: getters, setters, constructors and the normal functions.
Explicit generation
The codeBlock can also be generated explicitly
Last updated