It sounds like you're looking for Java reflection. That's a little offtopic for this forum, but you might want to check out what our neighbors at Stackoverflow have to offer.
Please note that if you're planning on running in the Mendix Cloud, you may not be able to run everything you want due to the security policies in place there.