title: using java generics to extend interfaces or just bad design?
body: <p>I'm still new to the Java world (former C++ programmer). I designed an Interface hierarchy to force my implementation to @Override the methods in the interfaces. Now I'm in some kind of "how to do this in java". All bellow are interfaces.</p>
  
  <pre><code>XMLDecoder      HTTPDecoder
      |                |
      ------------------
              |
          SSODecoder                  UserStuff
              |                           |
              -----------------------------
                           |
                           |
                       SSOBinding
                           |
                           |
                       Assertion
  </code></pre>
  
  <p>Now the fun part is I have an object implementing SSOBinding and another implementing Assertion. My problem is both <strong>HAVE</strong> to implement every method in XMLDecoder <strong>AND</strong> HTTPDecoder. I believe I have some pretty design but for that :(</p>
  
  <p>Can Java Generics help me solve this problem? Something like:</p>
  
  <pre><code>Assertion&lt;XMLDecoder&gt; anAssertion = new Assertion&lt;XMLDecoder&gt;();
  anAssertion.OnlyMethodsInXMLDecoder();
  </code></pre>
  
  <p>At least that's what I can think of for now but not having any success in implementing this.</p>
  
  <p>Thanks a lot!</p>
  
  <hr>
  
  <h2>EDIT 1</h2>
  
  <p>Sorry for my poor explanation. </p>
  
  <p>The hierarchy is not upside down (on top are the bases).</p>
  
  <p>SSODecoder is my problem. I know it can have either require <strong><em>XMLDecoder</em></strong> OR an <strong><em>HTTPDecoder</em></strong>. Forget about SSOBinding. So I could have an implementation:</p>
  
  <pre><code>class AssertionImpl1 implements Assertion {
         // Only implementing XMLDecoder
  }
  
  class AssertionImpl2 implements Assertion {
         // Only implementing HTTPDecoder
  }
  </code></pre>
  
  <p>The only difference for these to would be the method they need to implement for the decoder.</p>