https://github.com/zaaarf/geb-processor
An annotation processor for Geb!, the Generative Event Bus.
https://github.com/zaaarf/geb-processor
annotation-processor java javapoet minecraft
Last synced: about 2 months ago
JSON representation
An annotation processor for Geb!, the Generative Event Bus.
- Host: GitHub
- URL: https://github.com/zaaarf/geb-processor
- Owner: zaaarf
- License: mit
- Created: 2023-08-22T09:06:25.000Z (almost 2 years ago)
- Default Branch: dev
- Last Pushed: 2025-01-19T16:42:45.000Z (4 months ago)
- Last Synced: 2025-02-14T04:32:19.502Z (4 months ago)
- Topics: annotation-processor, java, javapoet, minecraft
- Language: Java
- Homepage: https://docs.zaaarf.foo/geb-processor/
- Size: 108 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Geb! Processor
This is the processor behind [GEB](https://github.com/zaaarf/geb)'s magic.## The trick
There is no trick, it's just basic metaprogramming.Suppose that you have a simple event system, with annotated listeners receiving Event objects. To process something like this at runtime, you need to ask every class to subscribe to the bus, then iterate all of its methods to find the annotated ones to call.
That works, of course, but it's not that fast. Ah, if only you knew in advance, such as at compile time, who's going to get called with what... oh, wait, you do.
The processor then writes at compile time direct calls to all subscribers into the events, to take as little time as possible.