首页    期刊浏览 2025年02月22日 星期六
登录注册

文章基本信息

  • 标题:Reflection Support: Java Reflection Made Easy
  • 本地全文:下载
  • 作者:Zalia Shams ; Stephen H. Edwards
  • 期刊名称:Open Software Engineering Journal
  • 印刷版ISSN:1874-107X
  • 出版年度:2013
  • 卷号:7
  • 期号:1
  • 页码:38-52
  • DOI:10.2174/1874107X20130422001
  • 出版社:Bentham open
  • 摘要:
    Large software projects often require the ability to load and manage new code assets that were not originally available during system compilation. Moreover, testing tools need to inspect and run code components regardless of their structures. Reflection in Java supports these tasks by providing programmers with facilities to dynamically create objects, invoke methods, access fields, and perform code introspection at runtime. These capabilities come at the cost of reduced readability and writeability, since code written using Java's reflection classes is clunky, bulky and unintuitive. Common tasks such as object creation, method invocation, and field manipulation need to be decomposed into multiple steps that require try-catch blocks to guard against checked exceptions. Type casts and explicit use of class types as parameters make development and maintenance of code difficult, time consuming and error prone. In this paper, we discuss the difficulties of using reflection in Java. We also present an open-source library called ReflectionSupport that addresses these problems and makes reflection in Java easier to use. ReflectionSupport provides static helper methods that offer the same reflective capabilities but that encapsulate the overhead of coding with reflection. This paper focuses on improving the usability of Java reflection by presenting an API that allows programmers to obtain the benefits of reflection without the hassle.
国家哲学社会科学文献中心版权所有