Java Reflection API Research (2)--java.lang.reflect detailed content and relationship

Source: Internet
Author: User
Tags modifier

For the latest java1.8, the structure of the interface in reflect is this:

  • Java.lang.reflect. annotatedelement
    • Java.lang.reflect. Annotatedtype
      • Java.lang.reflect. Annotatedarraytype
      • Java.lang.reflect. Annotatedparameterizedtype
      • Java.lang.reflect. annotatedtypevariable
      • Java.lang.reflect. Annotatedwildcardtype
    • Java.lang.reflect. genericdeclaration
    • Java.lang.reflect. typevariable<D> (also extends Java.lang.reflect.Type)
  • Java.lang.reflect. Invocationhandler
  • Java.lang.reflect. Member
  • Java.lang.reflect. Type
      • Java.lang.reflect. Genericarraytype
      • Java.lang.reflect. Parameterizedtype
      • Java.lang.reflect. typevariable<D> (also extends Java.lang.reflect.AnnotatedElement)
      • Java.lang.reflect. Wildcardtype

Several sub-interfaces under the Annotatedtype can be used without a tube, and other structures look very simple.

The inheritance structure of the class is as follows:

  • Java.lang.reflect. AccessibleObject (Implements Java.lang.reflect.AnnotatedElement)
    • Java.lang.reflect. executable (Implements Java.lang.reflect.GenericDeclaration, Java.lang.reflect.Member)
      • Java.lang.reflect. Constructor<T>
      • Java.lang.reflect. Method
    • Java.lang.reflect. Field (Implements Java.lang.reflect.Member)
  • Java.lang.reflect. Array
  • Java.lang.reflect. Modifier
  • Java.lang.reflect. Parameter (Implements Java.lang.reflect.AnnotatedElement)
  • Java.security. Permission (Implements Java.security.Guard, java.io.Serializable)
    • Java.security. basicpermission (Implements Java.io.Serializable)
      • Java.lang.reflect. reflectpermission
  • Java.lang.reflect. Proxy (Implements Java.io.Serializable)

Where the security of a few can first ignore

And for Java.lang.reflect.ReflectPermission, his main function is to remove the reflection of the default permission control, allowing direct manipulation of objects such as the private modifier of the property or method, and so on.

Because the default behavior of the reflection mechanism is limited to Java access control, for example, access to private methods, fields, unless you have access to it, Java security allows you to see which fields are available to any object, without allowing them to read their values (read throws an exception). However, if a Java program is not under the control of the security manager, access control can be overridden. To achieve this, you need to invoke the Setaccessible () method of the field, method, constructor object.

The Permission class for the reflection operation. Reflectpermission is a specified permission , no action. The currently defined unique name is suppressaccesschecks, which allows the cancellation of standard Java-language access checks performed by the reflective object on its point of use-for public, default (package) access, protected, Private member.

The inheritance and implementation diagram for this package is as follows:

Java Reflection API Research (2)--java.lang.reflect detailed content and relationship

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.