Java Reflection API
Java Reflection is a powerful tools to dynamically instantiate objects. It is especially helpful and reduce the amount of code to be written. Fields, Methods and Constructors are the members of the reflectors.
Sample codes from Java
The Class.getField() and Class.getFields() methods return the public member field(s) of the class, enum, or interface represented by the Class object. To retrieve all
fields declared (but not inherited) in the Class, use the Class.getDeclaredFields() method.
But, one note is that
An IllegalAccessException may be thrown if an attempt is made to
get or set the value of a private or otherwise inaccessible field or to set the
value of a final field (regardless of its access modifiers).
The same goes to Method. This is kind of a setback.