Type metadata properties and methods
The type Type is the root type of all types. Every Type
includes metadata properties and methods, such as the DisplayName property
and the isAssignableFrom method. You use the Type property
of a type to access the metadata. Although the metadata properties are available directly on
the type, best practice is to use the Type property because static
properties on a type override Type properties of the same name.
General type metadata
- Abstract
- If the type is abstract, this property is
true. - Array
- If the type is an array, this property is
true. - DisplayName
- The human-readable name of the type.
- Final
- If the type is final, this property is
true. - GenericType
-
If the type is a parameterized type, this property is the raw generic type of the type.
If the type is a raw generic type, this property is this type.
If the type is neither a parameterized type nor a raw generic type, this property is
null.For example, for a type of
ArrayList<String>, theGenericTypeproperty isjava.util.ArrayList. - Interface
- If the type is an interface, this property is
true. - isAssignableFrom
-
If the type is assignable from a variable of a specified type, this method returns
true.Boxed types, such as
BooleanandInteger, can be assigned to and from other boxed types only. If either variable type referenced in theisAssignableFromexpression is a primitive, such asbooleanorint, the method returnsfalse. - isGenericType
-
If the type is a raw generic type, this method returns
true.For example, for the type
ArrayList<String>, this method returnsfalse. For the typejava.util.ArrayList, this method returnstrue. - ParameterizedType
-
If the type is parameterized, this property is
true.For example, for the type
ArrayList<String>, this property istrue. For the raw generic type ofjava.util.ArrayList, this property isfalse. - Primitive
- If the type is primitive, this property is
true. - Supertype
- The supertype of the type. If no supertype exists, this property is
null. - TypeInfo
- Contains metadata about properties and methods of the type.
Type metadata for entities and typekeys
Gosu typekeys and some Gosu entities have additional type metadata that is not included
with the general metadata. For example, Gosu typekeys have a metadata method called
getTypeKeysByCategories that is available only on typekey data types. To
access the entity and typekey metadata, reference the data’s TYPE property
and get method. The code sample below demonstrates the appropriate
syntax.
var myTypekeys = new TypeKey[10]
NoteSecurityType.TYPE.get().getTypeKeysByCategories(myTypekeys)
The TYPE property is available only on Gosu entity and typekey data
types.
