Java反射与内省的区别

来源:互联网 发布:北京棉花检验数据平台 编辑:程序博客网 时间:2024/05/24 15:36

来自Struct文档一段说明,说明了反射和内省的关系,翻译了一下:

Reflection is the process of determining which member fields and methods are available on an object.

反射是一个确定有哪些成员变量、成员方法可在一个对象上使用的过程。

 Introspection is a specialized form of reflection used by the JavaBean API. Using Introspection, we can determine which methods of a Object are intended to be accessed by other objects. The getters and the setters, for example.

内省是一种特殊的反射,被用于JavaBean API。通过使用内省,我们可以确定一个对象中哪些方法适用于被其他对象访问。例如:getter和setter方法。

很多人搞不清反射和内省的关系,今天看Struct的文档发现这段说明。不过看后感觉内省的概念也是模模糊糊的,希望大神一起来讨论下。





1 0