本文主要是介绍Java反射与内省的区别,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
来自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的文档发现这段说明。不过看后感觉内省的概念也是模模糊糊的,希望大神一起来讨论下。
这篇关于Java反射与内省的区别的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!