Finding Getters and Setters with Java Reflection

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 […]

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 […]

JavaFX Sketch Pad: Version 2

In our previous post we presented a JavaFX Sketch Pad example that uses three RGB sliders to manipulate a drawing line’s color. In this post, we’ll use a color picker made with all the JavaFX built-in colors. Since JavaFX colors are are static fields with familiar (and maybe not so familiar) names like BLUE, GREEN, […]