Creating a new enhancement
To create a new enhancement, put the file in your Gosu class file hierarchy in the package that represents the enhancement. It does not need to match the package of the enhanced type.
In Studio, right-click a package folder, and then click Enhancement. In the dialog that appears, you can enter the enhancement class name and the type, which is typically a class name or entity type name, to enhance. Studio creates a new enhancement with the appropriate syntax.
Enhancement methods can use properties already defined on the enhanced object or call other enhanced methods.
Enhanced methods can also call native methods, as demonstrated by the getPrettyLengthString
method, which calls the built-in String method length().
You can add new properties as necessary and access those properties on the class or type within Gosu. However, you cannot save state information for the enhancement unless you can do so by using variables or properties that already exist on the enhanced type.
