Accessing type metadata properties and methods
Gosu exposes some type metadata as methods and properties associated with each Gosu type.
In version 8.0, methods (such as isAssignableFrom) or properties
(such as Supertype) were
moved to the Type property.
The corresponding methods and properties directly on the type were deprecated.
In version 9.0, the deprecated methods
and properties were removed and are now compilation errors. To fix the
error, before the metadata method or property, add the word Type followed by a period character.
Use the PolicyCenter upgrade
tools to update existing code to the new style.
For example, this type metadata method call worked, but was deprecated in version 8.0.
String.isAssignableFrom(Number)That statement is a compilation error in version 9.0. Instead, use the following code.
String.Type.isAssignableFrom(Number)Also in version 9.0, type
metadata methods and properties specific to Gosu entities and typekeys
are accessible from the item’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. The
PolicyCenter upgrade tools can
update existing code to the new syntax.
