Day 1 Java Reflection

Day 1 Java Reflection

Computer programming is always an art. ————James Gosling(Java之父)

Reflection is commonly used by programs which require the ability to examine or modify the runtime behavior of applications running in the Java virtual machine.
对于需要在运行时,检查或修改程序的状态或行为的Java应用来说,反射是一种很常用的技术。

This is a relatively advanced feature and should be used only by developers who have a strong grasp of the fundamentals of the language.
反射是一种比较高级的编程技术,程序员应该在对Java的基础知识有了牢靠掌握之后,再去使用它。

With that caveat in mind, reflection is a powerful technique and can enable applications to perform operations which would otherwise be impossible.
记住这条提醒,反射确实是一种很强大的技术,它使得你的程序能进行某些特定的操作,而这些操作不使用反射是无法完成的。

Reflection is powerful, but should not be used indiscriminately.
反射虽然很强大,但不应该不加选择就去使用它。

If it is possible to perform an operation without using reflection, then it is preferable to avoid using it.
如果某种操作是不经过反射就可以实现的,那我们就倾向于避免使用反射。

Because reflection involves types that are dynamically resolved, certain Java virtual machine optimizations can not be performed.
由于反射涉及到一部分只能在运行时才能动态绑定的类型,因此java虚拟机中的某些优化程序就没法执行了。

Consequently, reflective operations have slower performance than their non-reflective counterparts, and should be avoided in sections of code which are called frequently in performance-sensitive applications.
因此,在对性能敏感的程序里,如果一段代码被反复调用,那在这段代码中要尽量避免使用反射。

本文选自:
https://docs.oracle.com/javase/tutorial/reflect/index.html

生词 音标 释义
commonly [ˈkɑ:mənli] adv. 通常地
require [rɪˈkwaɪr] v. 需要
reflection [rɪˈflɛkʃən] n. 反射
modify [ˈmɑ:dɪfaɪ] v. 修改
runtime [rʌn'taɪm] n. 运行时刻
examine [ɪɡˈzæmɪn] v. 检查
virtual [ˈvɜ:rtʃuəl] adj. 虚拟的
relatively [ˈrɛlətɪvlɪ] adv. 相对的
feature [ˈfitʃɚ] n. 特征
grasp [græsp] v. 理解
fundamental [ˌfʌndəˈmɛntl] n. 基础
caveat [ˈkeviˌæt] n. 警告
enable [ɛˈnebəl] v. 使能够
perform [pərˈfɔ:rm] v. 执行
otherwise [ˈʌðərwaɪz] adv. 不然,否则
indiscriminately [ˌɪndɪ'skrɪmɪnətlɪ] adv. 不加选择的
preferable [ˈprɛfərəbəl] adj. 更好地
avoid [əˈvɔɪd] v. 避免
involve [ɪnˈvɑ:lv] v. 包括
dynamically [daɪ'næmɪklɪ] adv. 动态的
resolved [rɪˈzɑ:lvd] adj. 下定决心的
optimization [ˌɑptəmɪˈzeʃən] n. 最优化
consequently [ˈkɑ:nsəkwentli] adv. 所以,因此
counterpart [ˈkaʊntərpɑ:rt] n. 相对物
frequently [ˈfrikwəntlɪ] adv. 往往;频繁地
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,488评论 0 10
  • PLEASE READ THE FOLLOWING APPLE DEVELOPER PROGRAM LICENSE...
    念念不忘的阅读 13,566评论 5 6
  • 故事发生在草原的夏天,漫山遍野的狼群,在饥不择食的寻找目标,山羊在吃它的草,羊群在远处快乐的过活。 对于狼的...
    d69c9301a02e阅读 200评论 0 3
  • 叶圆轻颤池中舞。 尖角角,朝空对举。 娉婷娜袅芳姿, 雨烟蒙,风味致度。 和春画与群芳谱。 绿袖舒,照水怜取。 莫...
    断红尘阅读 171评论 0 0
  • 前言 Unix是开源运动历史上最著名的代表之一,而如今前端是开源运动中最活跃的一支队伍,我相信它们两者之间一定有共...
    云峰yf阅读 3,338评论 0 6