reflect.Type.getAttribute
Returns the value of a definition attribute.
Syntax
getAttribute(
name STRING )
RETURNS STRING
- name is the case-sensitive name of the definition attribute to be returned.
Usage
The getAttribute()
method returns the value associated to a definition attribute for this
reflect.Type
object representing a type.
A variable or type definition attribute is specified with the
ATTRIBUTES()
clause.Note:
The name of the attribute is case-sensitive.
Example
IMPORT reflect
MAIN
DEFINE rec RECORD ATTRIBUTES(json_name="a person")
pkey INTEGER ATTRIBUTES(json_name="the key"),
name VARCHAR(30) ATTRIBUTES(json_name="the name")
END RECORD
DEFINE typ reflect.Type
LET typ = reflect.Type.typeOf( rec )
DISPLAY "rec attribute : ", typ.getAttribute("json_name")
DISPLAY "field 1 attr : ", typ.getFieldType(1).getAttribute("json_name")
DISPLAY "field 2 attr : ", typ.getFieldType(2).getAttribute("json_name")
END MAIN
Shows:
rec attribute : a person
field 1 attr : the key
field 2 attr : the name