June 2016

How To - Simple Java Reflection

Reflection is the ability of a computer program to examine, introspect, and modify its own structure and behavior at runtime. Reflection is very useful for creating frameworks, serializers, metaprogramming, among other solutions. Let’s have a quick intro on how to do reflection in Java and how it works.

Suppose we have these classes: