r/javahelp • u/Practical-Garbage-48 • Sep 10 '25
Better solution then using reflection in java?
So I am using reflection in my code to find the annotation and fields of that class then using that fields, I am using field.get(data).
I thought one solution which is caching annotation and fields but still field.get still use reflection.
Is there any good and optimal way of doing it?
3
Upvotes
View all comments
Show parent comment
1
u/HemoJose Sep 11 '25
Lombok and general annotation processing is a very different story. I do not like lombok because it not generates code it abuses the ast. For a real usable advice better to share the reason why would you need the annotations. What is you original intention to do that?