title: Ignoring specific overloaded methods with Swig
body: <p>I'm making a wrapper of a C++ library so it can be used from Java, I'm doing this with Swig.</p>
  
  <p>What I'm facing is that i have a Class <code>SomeClass</code>, which has some overloaded methods (<code>someMethod</code>). Of this overloaded methods some receive complex data that i don't want to export to the wrapper, and some simple ones which i do want then exported.</p>
  
  <p>I'm trying to use the <code>%rename("$ignore")</code> directive but either i get all methods exported or none. I have another two types of Classes <code>SimpleData</code> and <code>ComplexData</code>, one of them in namespace <code>ns1</code> and the other in <code>ns2</code>, <code>SomeClass</code> is in namespace ''ns3`.</p>
  
  <p>The class <code>SimpleData</code>:</p>
  
  <pre><code>#ifndef SIMPLEDATA_H_
  #define SIMPLEDATA_H_
  
  namespace ns1 {
  
  class SimpleData {
  public:
      SimpleData(){}
      virtual ~SimpleData(){}
  };
  
  } /* namespace ns1 */
  #endif /* SIMPLEDATA_H_ */
  </code></pre>
  
  <p>The class ComplexData:</p>
  
  <pre><code>#ifndef COMPLEXDATA_H_
  #define COMPLEXDATA_H_
  
  namespace ns2 {
  
  class ComplexData {
  public:
      ComplexData(){}
      virtual ~ComplexData(){}
  };
  
  } /* namespace ns2 */
  #endif /* COMPLEXDATA_H_ */
  </code></pre>
  
  <p>The class <code>SomeClass</code>:</p>
  
  <pre><code>#ifndef SOMECLASS_H_
  #define SOMECLASS_H_
  
  #include "SimpleData.h"
  #include "ComplexData.h"
  
  namespace ns3 {
  
  class SomeClass {
  public:
      SomeClass(){}
      bool someMethod(const ns1::SimpleData &amp; data){return true;}
      bool someMethod(const ns2::ComplexData &amp; data){return true;}
      bool someMethod(const int &amp; data){return true;}
      bool anotherMethod();
      virtual ~SomeClass(){}
  };
  
  } /* namespace ns3 */
  #endif /* SOMECLASS_H_ */
  </code></pre>
  
  <p>The i file snippet looks like this:</p>
  
  <pre><code>%rename ("$ignore", fullname=1) "ns3::SomeClass::someMethod(const ns2::ComplexData&amp;)";
  </code></pre>
  
  <p>But that isn't working. Which one is the correct way of ignoring some specific overload of a method?</p>
  
  <p>The full .i file:</p>
  
  <pre><code>%module libSomeClass
  
  %{
      #include "../src/SomeClass.h"
  %}
  
  %pragma(java) jniclasscode=%{
    static {
      try {
          System.loadLibrary("SWIG_C++");
      } catch (UnsatisfiedLinkError e) {
        System.err.println("Native code library failed to load. \n" + e);
        System.exit(1);
      }
    }
  %}
  
  // SimpleData
  %include "../src/SimpleData.h"
  
  //removes too much
  //%rename ("$ignore", fullname=1) "ns3::SomeClass::someMethod";
  
  //does not work
  %rename ("$ignore", fullname=1) "ns3::SomeClass::someMethod(const ns2::ComplexData &amp;)";
  
  %rename ("renamedMethod", fullname=1) "ns3::SomeClass::anotherMethod";
  
  %include "../src/SomeClass.h"
  </code></pre>
  
  <p>Note: I don't think it actually has nothing to do but just in case, those methods actually throw a exception.</p>
  
  <p>Note2: I also don't think is relevant, but the target language is Java and the source language is C++.</p>