Java_反射
反射(Reflecting)是Java的特征之一,它允许Java程序在运行期间,操作类或对象的内部属性。
Oracle官方对反射的解释是:
Reflection enables Java code to discover information about the fields, methods and constructors of loaded classes, and to use reflected fields, methods, and constructors to operate on their underlying counterparts, within security restrictions.
The API accommodates applications that need access to either the public members of a target object (based on its runtime class) or the members declared by a given class. It also allows programs to suppress default reflective access control.反射使Java代码具有在安全限制下发现装载类字段,方法和构造器并且使用反射字段,方法和构造来操作类的的底层对象。
API容纳需要访问目标对象的公共成员(基于其运行时类)或给定类声明的成员的应用程序。它还允许程序抑制默认的反射访问控制。