https://github.com/apontini/greeter
Test project to get to know code generation with KAPT and KotlinPoet
https://github.com/apontini/greeter
annotation-processor code-generation kapt kotlin kotlinpoet maven mvn
Last synced: about 2 months ago
JSON representation
Test project to get to know code generation with KAPT and KotlinPoet
- Host: GitHub
- URL: https://github.com/apontini/greeter
- Owner: apontini
- License: gpl-3.0
- Created: 2021-12-31T09:25:52.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-01-04T16:02:09.000Z (over 4 years ago)
- Last Synced: 2025-10-21T04:11:39.165Z (8 months ago)
- Topics: annotation-processor, code-generation, kapt, kotlin, kotlinpoet, maven, mvn
- Language: Kotlin
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AutoGreeter
Do you find yourself struggling to remember to send seasonal greetings or to wish happy birthday to someone? Well, fear
not! AutoGreeter is here! The only thing you need to do is to create a function with no parameters and annotated
with `@Greeter` like this:
```kotlin
companion object {
@Greeter("05-12", "00:30") //00:30 because we don't want to let people know we're a bot, right?
fun greetSomebody() {
//...
}
}
```
And this method will be called on December 12 of every year at exactly 00:30.
To generate scheduled greetings just run `mvn clean install`.
Jokes aside, this is a small project that I made to study how to generate code starting from annotations using KAPT (and
not KSP since, at the time of writing, it doesn't have and expanded support). An arguably better way to handle such a
task would've been to implement some sort of Kotlin DSL such as:
```kotlin
greetings {
greetAt("12-31", "00:00") {
//run something
}
}
```
Or just, you know, use some cron-like library.