I'd like to work with a class that is only available in my runtime environment, and I don't have any .java or .class files of it. The only way to use it AFAIK is through reflection.
What I already did, is to write a small program to get the Class
instance of my target class, iterate through its public methods/fields and get their signature (similar as in this program). Then I manually filled the bodies of those methods so that they call the real methods using reflection. This way I could use the target class without filling my code with Method/Field getters.
Here are my questions:
- Is there a specific term for what I'm trying to do? ("Java reflection wrapper code generator" maybe?)
- Is there a tool that automates the task I did manually above?
- If not, what are the challenges in building such a tool?
Aucun commentaire:
Enregistrer un commentaire