Documentation for directors and virtual final methods
This commit is contained in:
parent
3b07cba740
commit
34108deec7
5 changed files with 19 additions and 13 deletions
|
|
@ -3629,7 +3629,7 @@ The %feature directive can be applied globally, to specific classes, and to spec
|
|||
// generate directors for all classes that have virtual methods
|
||||
%feature("director");
|
||||
|
||||
// generate directors for all virtual methods in class Foo
|
||||
// generate directors for the virtual methods in class Foo
|
||||
%feature("director") Foo;
|
||||
</pre>
|
||||
</div>
|
||||
|
|
@ -3647,7 +3647,7 @@ So for example,
|
|||
</div>
|
||||
|
||||
<p>
|
||||
will generate directors for all virtual methods of class Foo except bar().
|
||||
will generate directors for the virtual methods of class Foo except bar().
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
|
@ -3683,7 +3683,8 @@ The director classes store a pointer to their underlying Java proxy classes.
|
|||
<p>
|
||||
For simplicity let's ignore the <tt>Swig::Director</tt> class and refer to the original C++ class as the director's base class.
|
||||
By default, a director class extends all virtual methods in the inheritance chain of its base class (see the preceding section for how to modify this behavior).
|
||||
Thus all virtual method calls, whether they originate in C++ or in Java via proxy classes, eventually end up in at the implementation in the director class.
|
||||
Virtual methods that have a final specifier are unsurprisingly excluded.
|
||||
Thus the virtual method calls, whether they originate in C++ or in Java via proxy classes, eventually end up in at the implementation in the director class.
|
||||
The job of the director methods is to route these method calls to the appropriate place in the inheritance chain.
|
||||
By "appropriate place" we mean the method that would have been called if the C++ base class and its Java derived classes were seamlessly integrated.
|
||||
That seamless integration is exactly what the director classes provide, transparently skipping over all the messy JNI glue code that binds the two languages together.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue