What is Java Reflection ?
Reflection makes program examining itself at run time and change its behavior, structure or data of program based upon the result of the examination.
Three Steps of Reflection :
1. Examine the program of its structure or data.
2. Make decisions using the results of examination.
3. Change the behavior, structure or data of the program based upon the decisions.
A small Example
public class HelloWorld{
public void printName(){
System.out.println(this.getClass().printName());
}
}
Related Concept
1. introspect : the process program to examine itself
2. base-level object : the objects that are used to accomplish the main purpose of the application
3. metaobjects : the object of Class which represent base-level object
Here is a diagram to represent the relationship of base-level and metaobjects: