The Reflection API enables Java code to discover information about itself. What if we had a Mutable Reflection API that enabled Java code to create new Java code. For example you could add/edit fields and methods (including implementation detail) and create new classes at runtime. The API could work at the source code level and generate bytecode dynamically at runtime.

Davanum Srinivas

Three possible options are as follows: