Contents |
Software development tools, such as GUI builders and debuggers, need to manipulate objects at runtime. For example, a GUI builder may allow the end-user to select aButton
from a menu of components, create theButton
object, and then click theButton
while 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.This lesson has the following sections:
Creating Objects
How can you create an object if you don't know its class name until runtime? 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 runtime.Setting Field Values
Not only can you get field values at runtime, you can also set them. This section shows you how.Invoking Methods
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.
Contents |