In this chapter, we look at the JavaFX Reflection application programming interface (API). Reflection is primarily of use to tools such as integrated development environments (IDEs) and code generators that need to work, at runtime, with classes that they have no prior knowledge of. Using reflection, you can load any class given its name, create an instance of that class, discover its variables and functions, read and set the values of those variable, and invoke its functions.
The classes that implement the JavaFX Reflection API can be found in the
javafx.reflect package. It is possible to use the Java Reflection APIs in the
java.lang.reflect package to inspect a JavaFX class, but Java reflection gives a Java view of a JavaFX ...