Locally Defined Imported Class Method Example

You can now add your own methods to imported classes in DemoApplicationSchema, in much the same way that you add methods to subschema copies of superschema classes. For example, note that in the appFini method in the previous "Imported Package Example" subsection, deleteLog is invoked for every Log object.

In DemoApplicationSchema, you can write your own method on LogManager to delete all log files, as shown in the following example.

LogManager::deleteAllLogs() updating;
vars
    log : Log;
begin
    foreach log in self.allLogs do
        self.deleteLog(log);
    endforeach;
end;

Note that deleteAllLogs is an extension of the imported class in the importing schema. With this locally defined method, you could write the appFini method as follows.

appFini() updating;
begin
    self.myLogManager.deleteAllLogs;
    delete self.myLogManager;
end;