By jschneider
via blog.cedarsoft.com
Published: Aug 07 2010 / 06:34
Everybody uses code generation. Every day.
Most of the times a templating enginge is used. That is great for simple cases.
But for more complex things like generating complete classes, there exists a nice (but forgotten?) API for that purpose.



Comments
iirekm replied ago:
Nice, I didn't know that such such convenience library exists.
I wrote lots about code generation and metaprogramming recently on my blog: http://coding-masters.blogspot.com/2010/07/metaprogramming-in-java.html
No we have a few different reflection APIs:
- the one from java.lang.reflect and javax.beans (read only, from loaded .class files)
- the one from Javassist and similar projects (read-write, for .class files, either loaded to JVM or not)
- 'mirror' API from APT (read only, from .java files)
- the API you present here (to .java files)
I would be happy if there existed an API that unified those 4 APIs into one superapi for reflection, manipulation of .class and .java files - in fact they are about the same thing, only the most 'persistence' part of these APIs is different.
jschneider replied ago:
One API to rule them all... Could be nice. But I don't know if this is really possible... But if you give it a try: I'd like to take a look at it ;-)
Voters For This Link (23)
Voters Against This Link (0)