I can successfully create class definitions at runtime using Javassist, but I also need the ability to rebuild the definitions to add/remove/change member data and their getters/setters. Is this at all possible? I'm using a custom class loader for the classes that I generate. I was hoping I could do something like this:
- create class definition in custom class pool (ClassPool(ClassPool parent))
- add to custom class loader
Then later:
- retrieve CtClass instance and detach it from the pool
- remove from custom class loader
- create new class definition with the same class path
- add to same custom class loader
Or alternatively:
- retrieve CtClass instance and detach it from the pool
- remove all fields and methods
- create new fields and methods
I should point out that no other classes reference or inherit this class. I simply store instances of this class in a hash map and list.
Is this at all possible? Thanks