java-reflection mechanism

Source: Internet
Author: User

1. Reflection

The Reflection library (Reflection Library) provides a rich set of tools for writing programs that dynamically manipulate Java code . This feature is

A large number of applications are in JavaBeans, which is the architecture of Java components.

A program capable of analyzing class capabilities is called reflection (Reflection), which means that a class (or base data type) can be manipulated as an object .

It is the structure and behavior of the runtime to detect and modify an object, unlike introspection (introspection). Introspection is a subset of reflection.

Reflection: Used to detect and modify the structure and behavior of an object at run time.

Introspection: Used to detect the type of an object and the properties it contains at run time.

Introspection instance: Object name instanceof class name/interface name;//Detect if an object belongs to a class or interface

Reflection instance: the Class.forName () method can get a class.

2.Class class

A class object actually represents a type , which is not necessarily a class, because it can also represent a basic data type.

It can use everything in Java (classes, interfaces, arrays, basic data types, void) as an object to access its properties.

java-reflection mechanism

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.