Software development tools, such as GUI builders and debuggers, need to manipulate objects at run time. For example, a GUI builder may allow the end-user to select a
Buttonfrom a menu of components, create the
Buttonobject, and then click the
Buttonwhile running the application within the GUI builder. If you're in the business of creating software development tools, you'll want to take advantage of the reflection API features described in this lesson.
How can you create an object if you don't know its class name until run time? You'll find the answer in this section.
Getting Field Values
In this section you'll learn how to get the values of an object's fields, even if you don't know the name of the object, or even its class, until run time.
Setting Field Values
Not only can you get field values at run time, you can also set them. This section shows you how.
This section shows you how to dynamically invoke methods. Given an object, you can find out what methods its class defines, and then invoke the methods.