Java reflection mechanism and application scenario

Source: Internet
Author: User

Java Reflection Mechanism:

http://www.programcreek.com/2013/09/java-reflection-tutorial/

Explanation of the problem of the Java reflection mechanism breaking the data encapsulation:

Http://stackoverflow.com/questions/16635025/dosent-reflection-api-break-the-very-purpose-of-data-encapsulation

Java Reflection Mechanism Application scenario:

1, for the Java EE, the ORM all based on dynamic bytecode and reflection technology, spring and other IOC framework based on dynamic agents (sometimes dynamic bytecode) and reflection technology, all kinds of popular MVC is servlet+ reflection implementation.

2, for Android, its own context.startactivity/sendbroadcast, etc. are based on reflection, such as Gson/jackson Json-orm are based on reflection, Reflection technology can also solve some cross-process call problems and system hack.

3. Unit test, same over reflection mechanism, unit test for private method

Java reflection mechanism and application scenario

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.