About the author
I recently worked on a project that wraps Android classes into callable wrappers from Delphi by reading from a Java archive (JAR). Since the Android platform uses Java, this dips into my Java skills.
Let's first look at the Delphi unit for an Android callable wrapper.
unit Namespace...; interface uses listofunits...; type // forward declarations CallableWrapper1 = interface; CallableWrapper2 = interface; CallableWrapper1Class = interface(SomeParentClass) // method declarations end; CallableWrapper1 = interface(SomeParent) end; TJCallableWrapper1 = class(TJavaGenericImport<CallableWrapper1Class, CallableWrapper1>) end; CallableWrapper2Class = interface(SomeOtherParentClass) // method declarations end; CallableWrapper2 = interface(SomeOtherParent) end; TJCallableWrapper2 = class(TJavaGenericImport<CallableWrapper2Class, CallableWrapper2>) end;
After obtaining the list of classes to generate wrappers for, there is a loop that iterates the class, and we need to run through it 2 times. Why 2 times? The first, is to generate the forward interfaces.
The second, is to generate the actual wrappers.
This article discusses the new Delphi 8 property access specifiers.
Continued discussion of undocumented Delphi 8 Property Access Specifiers, and other ways of adding and removing delegates / events handlers, including clearing the list of all the delegates / event handlers.