Internal use in Java

Source: Internet
Author: User

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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.