Java Reflection Tutorial

About the author

Daniel Gutierrez Diez holds a Master in Computer Science Engineering from the University of Oviedo (Spain) and a Post Grade as Specialist in Foreign Trade from the UNED (Spain).

Daniel has been working for different clients and companies in several Java projects as programmer, designer, trainer, consultant and technical lead.

This guide is about reflection, the ability of a computer program to examine and modify the structure and behavior (specifically the values, meta-data, properties and functions) of the program at runtime.

We are going to explain what reflection is in general and how can be used in Java. Real uses cases about different reflection uses are listed in the next chapters.

Several code snippets will be shown; at the end of this tutorial you can find a compressed file that contains all these examples (and some more).

All code has been written using Eclipse Luna 4.4 and Java update 8.25, no third party libraries are needed.

 

Java Reflection Tutorial includes:

  1. Reflection components and mechanisms
  2. Classes
  3. Interfaces
  4. Enums
  5. Primitive types
  6. Fields
  7. Methods
  8. Constructors
  9. Getters and Setters
  10. Static elements
  11. Arrays
  12. Collections
  13. Annotations
  14. Generics
  15. Class Loaders
  16. Dynamic Proxies
  17. Java 8 Reflection features
JCG eBooks are professionally designed, downloadable collections of popular JCG content – articles, interviews, presentations, and research – covering the latest software development technologies, trends, and topics.
Back to top button