reflect.Type.getFieldTypeByName
Returns the type of a member of a record type, from the member name.
Syntax
getFieldTypeByName(
name STRING )
RETURNS reflect.Type
- name is the name of the field in the
RECORD
structure. The field name is case sensitive.
Usage
The getFieldTypeByName()
method returns a reflect.Type
object
that corresponds to a member with the name passed as parameter, for the record type represented by
this reflect.Type
object.
The name of the field (record member) is case sensitive. The parameter
passed to this method must match the name used in the RECORD
or
TYPE
definition. If the parameter does not match a record field name, the method
returns NULL
.
The reflect.Type
object used to call this method must have been
created with a RECORD
variable, or is a
reflect.Type
object returned from a method like reflect.Value.getType()
or getElementType()
, and
references a record structure.
Example
IMPORT reflect
MAIN
DEFINE rec RECORD
pkey INTEGER,
name VARCHAR(30)
END RECORD
DEFINE typ reflect.Type
LET typ = reflect.Type.typeOf( rec )
DISPLAY "type = ", typ.getFieldTypeByName("name").toString()
END MAIN
Shows:
type = VARCHAR(30)