美文网首页
Day 1 Java Reflection

Day 1 Java Reflection

作者: mocobk | 来源:发表于2018-07-12 14:31 被阅读0次

    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. 往往;频繁地

    相关文章

      网友评论

          本文标题:Day 1 Java Reflection

          本文链接:https://www.haomeiwen.com/subject/ukfrpftx.html