Java Reflection Removal
Yesterday, I was, as the say, refactoring a library I wrote called Madlib. With it, I build Java object trees in XML, by specifying the properties missing from the heirarchy. So, I named it for the children’s word game that operates on the same premise. (Thinking about renaming it though.)
This is how Relays are built in Relay. A terse document can build a complicated object tree.
It uses a template document to describe the heirarchy. Using XStrategy, I build the templates by finding classes with the specified names, methods and signatures, and adding the place holders.
The reflection constructor and method objects are obtained, and a structure is build that can be given to another XStrategy composition, that will use that structure to build objects through reflection.
This was a candidate for ASM 2.0 trickery, for a while, but I throught about it, and figured that I had to put so much information in the template document to get reflection to work, it wasn’t any better than writing out the Java code. I decided to write a decent Java library for constructing these templates.
Which is what I did yesterday.