Accessing general type metadata
To access general type metadata, retrieve the Type property of the data by using the
typeof operator. The following example accesses various type metadata values on the
java.util.ArrayList type.
var stringList = {"cat", "dog"}
var t = typeof stringList
print("Name = " + t.DisplayName)
print("Supertype = " + t.Supertype.DisplayName)
print("isAssignableFrom(Object) = " + t.isAssignableFrom(Object))
print("Example method name = " + t.TypeInfo.Methods[0].DisplayName)
Alternatively, the Type property of a data type can be referenced directly to access the type’s
metadata. The following example demonstrates the syntax to access the metadata of the ArrayList
class.
var alt = ArrayList.Type
print("Name = " + alt.DisplayName)
print("Supertype = " + alt.Supertype.DisplayName)
print("isAssignableFrom(Object) = " + alt.isAssignableFrom(Object))
print("Example method name = " + alt.TypeInfo.Methods[0].DisplayName)
The output from the example code is identical for both of these techniques.
Name = java.util.ArrayList<java.lang.Object>
Supertype = java.util.AbstractList<java.lang.Object>
isAssignableFrom(Object) = false
Example method name = clone
