The reflect.Type class
The reflect.Type
class is a generic API to inspect types.
reflect
C-Extension library; To use this class, import the reflect
package
with:IMPORT reflect
A reflect.Type
object is the runtime representation of a type. A type can be
anonymous (when defining a variable directly with a
type specification), or it can be a user-defined and named type, created from a TYPE
instruction.
Several methods of this API are restricted to special kinds of types. For example, only the
reflect.Type
objects of kind "ARRAY"
and
"DICTIONARY"
can return an element-type with getElementType()
. The
program should check the kind of a type before calling kind-specific methods. The kind of a type an
be checked with the getKind()
method.
The exceptions thrown by the
reflect.*
API can only be caught with a TRY/CATCH
block: If WHENEVER
ERROR CONTINUE
is active and the reflection API throws an exception, the program
stops.