I'm looking for some metaprogramming functions in Java analogous to Python's getattr, hasattr, callable etc. If not, is there any good external library for this?
As Eduardo commented, you can use reflection. Here's Sun's (Oracle, now) article about it:
http://java.sun.com/developer/technicalArticles/ALT/Reflection/
That should get you heading in the right direction.