The reflection mechanism of Java review

Source: Internet
Author: User

1. The role of the GetClass () method in the object class

Get the class where the object resides

2. Java Reflection mechanism

Class

Three ways to instantiate a class class object:

Forname () method

Classes. Class

Object. GetClass ()

3. Perform instantiation of objects with class

Newinstance (), must have no parameter constructor

4. Using the constructor class to invoke a constructor method to complete the instantiation of an object

GetConstructors ()

5. Reflection Applications

All interfaces to be implemented using reflection, getinterfaces (); GetName ()

A class inherits from the parent class, Getsuperclass (); GetName ()

All construction methods of a class, GetConstructors ()

All the methods in a class,

All properties in a class

Java.lang.reflect:constructor,field,method are subclasses of the AccessibleObject class

Modifier class

6. The specified method in the Reflection invocation class

GetMethod (), Invoke ()

7. Reflection completion of setter and getter method invocation

8. Reflection properties in the Direct Action class

GetField ()

Getdeclaredfield ()

Get ()

Set ()

Setaccessible ()

9. Array of reflection operations

10. The role of dynamic agents

Invocationhandler interface and the role of the proxy class

12. Reflection on the improvement of plant design pattern

13. Theory of separation of code and configuration

The reflection mechanism of Java review

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.