Java Reflection provides a set of useful APIs that help you find methods in Java classes. You can find all the methods in a class or a method with a specific name and signature. Surprisingly, there are no APIs to determine if a Java method is a getter or a setter. In this post, I’ll […]
Author Archives: Paul Anderson
Finding Generic Types with Java Reflection
Sometimes you need to access type information as Java programs execute. Accessing a field’s type, for instance, is necessary to invoke a setter or getter for that field at run time. And obtaining types for a method’s parameters and return value let you invoke that method “on-the-fly” when needed. In this post, I show you […]
Navigating Class Hierarchies with Java Reflection
Java Reflection makes it easy to find fields, methods, and constructors in your Java classes. Most of the time a single class is all you need to look at. However, sometimes you need to navigate through a class hierarchy. In this post, I’ll show you how to use Java Reflection to navigate class hierarchies. You’ll […]