Home > Articles > Programming > Java

  • Print
  • + Share This
This chapter is from the book

3.8 Onward

Java reflection preserves name and type information in the compiled class format. This is an evolution from many pointer-based programming languages, which make compile-time assumptions about name and type that might fail to be true at runtime. The availability of class metadata makes the dynamic linking of code more reliable.

Most of the metadata in the class file is also exposed programmatically, via the Reflection API. Reflection includes both discovery and invocation. Reflective invocation can be used to write generic services that adapt themselves to the types they discover at runtime. Dynamic proxies extend the notion of a generic service further by allowing service classes to be manufactured at runtime. While reflective access is noticeably slower than direct access, it is fast enough to be used as the glue code between component, process, or network boundaries.

  • + Share This
  • 🔖 Save To Your Account