all, section 19.
19. Reflection API
Most of the stuff 'stolen' from
Dale Green.
The
reflection API
represents,
or reflects, the classes, interfaces, and objects in the current Java Virtual
Machine.
Typical use:
-
debuggers,
-
class browsers,
-
GUI builders.
With the reflection API you can:
-
Determine the class of an object.
-
Get information about a class's modifiers, fields, methods, constructors, and superclasses.
-
Find out what constants and method declarations belong to an interface.
-
Create an instance of a class whose name is not known until runtime.
-
Get and set the value of an object's field, even if the field name is unknown to your program until
runtime.
-
Invoke a method on an object, even if the method is not known until runtime.
-
Create a new array, whose size and component type are not known until runtime, and then
modify the array's component
Created by
unroff,
java2html &
& hp-tools.
© by csfac. All Rights Reserved (2010).
It is not allowed to print these pages on a CAST printer.
Last modified: 01/April/10 (17:16)