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

Witold E Wolski wewolski at gmail.com
Wed Nov 5 11:28:00 EST 2014


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


More information about the CMake mailing list