fujaba / fulibFx

A framework for JavaFX applications that is designed for MVC pattern projects.
https://fujaba.github.io/fulibFx/
MIT License
2 stars 0 forks source link

Annotation Processor: Sidecar Generator #76

Closed Clashsoft closed 5 months ago

Clashsoft commented 5 months ago

New Features

Sidecars are a performance and understandability improvement over the reflection code that is currently used. Instead of several reflective calls to methods annotated with OnInit, OnRender, Param, etc., these methods are collected at compile time and their calls including proper parameter injection are generated into the Sidecar class. At runtime, the ControllerManager can check for existing Sidecar classes (for a component FooComponent, the sidecar class will always be called FooComponent_Fx), and statically invoke the predefined methods for init, render, destroy, resources, title, etc.. If no sidecar exists, the manager can fall back to reflection.

Benefits:

Drawbacks:

If we want to enforce the use of the annotation processor, we can even remove all reflective implementations entirely.

Clashsoft commented 5 months ago

@LeStegii Please add a check/warning for private fields and methods with our annotations. Feel free to add to this PR or merge first and create a new one.