Introspection use of JAVA

http://www.cnblogs.com/H_Razor/archive/2011/02/28/1967178.html

 

Reference the following two paragraphs:

http://blog.sina.com.cn/s/blog_5d06a3c70100b521.html

Reflections on introspection

    struts2's action (there struts1 of formbean) is so achievable.

    The reception form tag has attributes (know this form is submitted to the action in the configuration file, and this action has the form and the corresponding attributes and get / set), after the submission, to be forwarded to a servlet stopped by the struts of a specific action. before being forwarded to the action by introspection Struts manner set value of the form to go into action.

    In fact, as long as there is a set ** or get **, introspection will understand that there is such a ** property, which can help us to define the Bean class without having to care about concrete implementation through an interface without worrying about data Bean of storage. For example, we can put all the getter / setter methods into the interface defined in, but the real data access is to be implemented in specific classes, which can improve the scalability of the system.

Summary of
    the Java reflection and introspection to apply to the program design can greatly provide intelligence and scalability of the program. There are many projects take these two techniques to achieve its core functions, such as we mentioned earlier Struts, there Digester project for processing XML files, in fact, it should be said almost all of the items are more or less adopted two techniques. In practical application process to combine the two with each other in order to play a real intelligent and highly scalable.

 

Reproduced in: https: //my.oschina.net/u/2552902/blog/543871

Guess you like

Origin blog.csdn.net/weixin_34388207/article/details/92326778