https://github.com/johnsonlee/codegen
A Lightweight Framework for Code Generating
https://github.com/johnsonlee/codegen
Last synced: about 1 year ago
JSON representation
A Lightweight Framework for Code Generating
- Host: GitHub
- URL: https://github.com/johnsonlee/codegen
- Owner: johnsonlee
- License: apache-2.0
- Created: 2022-03-27T13:48:27.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-20T09:34:47.000Z (almost 4 years ago)
- Last Synced: 2025-03-28T23:51:11.908Z (about 1 year ago)
- Language: Kotlin
- Size: 123 KB
- Stars: 60
- Watchers: 2
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Codegen
A lightweight framework for code generating.
## Why Codegen?
In Java/Kotlin world, engineers usually use [JavaPoet](https://github.com/square/javapoet) or [KotlinPoet](https://github.com/square/kotlinpoet) for code generating, those tool libraries are really cool, but it increases code maintainability, using [JavaPoet](https://github.com/square/javapoet) or [KotlinPoet](https://github.com/square/kotlinpoet) to generate Java/Kotlin source code like using JSP languages to write a web page, you never know what you have written after a few months.
Codegen separates the generating logic into template and data model, it a little bit like SSR (Server Side Rendering), and provides the well-known template engines integration, e.g. [Mustache](https://mustache.github.io/), [Velocity](https://velocity.apache.org/), it also supports custom template engine.
## Example
See the example of [AutoFactoryCodegen.kt](./example/src/main/kotlin/io/johnsonlee/codegen/example/AutoFactoryCodegen.kt)