13. Reflection

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 ...

Get JavaFX™ Developer’s Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.