Http://www.cnblogs.com/H_Razor/archive/2011/02/28/1967178.html
See the following two sections:
Http://blog.sina.com.cn/s/blog_5d06a3c70100b521.html
Thoughts on Introspection
The struts2 action (and the formbean of struts1) is implemented in this way.
The form tag at the front end has some attributes (the configuration file knows that the form is submitted to the action, and this action has the attributes corresponding to this form and their get/set). After submission, the struts servlet blocks and forwards the request to a specific action. before forwarding to the action, Struts sets the value in form to the action by saving the province.
In fact, as long as there is a set ** or get **, the province will understand that there is such a ** attribute, this makes it easy for us to define bean classes through an interface without worrying about the specific implementation, rather than concerning the storage of bean data. For example, all the getter/setter methods can be defined in the interface, but the real data access is implemented in a specific class, which can improve the scalability of the system.
Summary
Apply Java reflection and introspectionProgramThe design can greatly provide the intelligence and scalability of the program. Many projects adopt these two technologies to implement their core functions. For example, we mentioned struts and the digester project used to process XML files, in fact, almost all projects adopt these two technologies more or less. In practical application, the two must be combined to achieve real intelligence and high scalability.