[CMake] [java] How do I add an "implements MyI" to Swig generated java class?

Witold E Wolski wewolski at gmail.com
Thu Nov 6 04:17:02 EST 2014


An answer to my question

https://stackoverflow.com/questions/5477747/cant-figure-out-how-to-make-swig-java-force-a-proxy-class-to-implement-an-inter


On 5 November 2014 17:28, Witold E Wolski <wewolski at gmail.com> wrote:
> I have some C++ classes which implement an interface.
>
> On the C++ side I have:
>
> struct Block{
> void waitForNotify()=0;
> }
>
> class B : Listener{
> void waitForNotify();
> ...
> }
>
> what I would love to get generated on the java side is:
>
> interface Block{
> void notifiy();
> }
>
> class B implements Block{
>    swig gernated
>    private long swigCPtr;
>      protected boolean swigCMemOwn;
>    ...
> ....
>  @Override
>     public boolean waitForNotify() {
>         return SwigTestWrappersJNI.B_waitForNotify(swigCPtr, this);
>     }
> }
>
> But what I get when I tell swig to wrap the Block interface and the
> class B is in java
>
> public class Block {
>   private long swigCPtr;
>   protected boolean swigCMemOwn;
>
>   protected Block(long cPtr, boolean cMemoryOwn) {
>     swigCMemOwn = cMemoryOwn;
>  .....
>
> }
>
> and
>
> public class B extends Block {
> ....
>
> So I am thinking about a solution just to let swig wrap the class B
> and declare in addition the interface Block also in java by hand but
> what I am missing at the moment is how to tell swig to add to the auto
> generated class B declaration the "implements Block" clause.
>
> Thank you
>
>
>
> --
> Witold Eryk Wolski



-- 
Witold Eryk Wolski


More information about the CMake mailing list