title: Java Multilevel Generic Inheritance
body: <p>The closest question I found (<a href="https://stackoverflow.com/questions/9655335/method-chaining-how-to-use-getthis-trick-in-case-of-multi-level-inheritance">Method Chaining: How to use getThis() trick in case of multi level inheritance</a>) did not have a direct answer to my problem. I'm currently using morphia and am setting up a rest service. I've seen many versions of how to implement this and decided to do it this way. I am completely open to suggestions however, learning how to get through this problem, will help my coding practices, at least I think it will. Also, I know my naming conventions may be off so a correction in that I am open to as well :)</p>
  
  <p>Here's my code:</p>
  
  <pre><code>                          1st
  /*****************************************************************************/
  public interface BaseRepository &lt;T extends BaseEntity&gt; {
      /* Methods Here */
  }
  public class BaseController&lt;T extends BaseEntity&gt; implements BaseRepository&lt;T&gt; {
      public BaseController(Class&lt;T&gt; type) {
           this.type = type;
      }
      /* Overridden Methods Here*/
  }
                           2nd
  /*****************************************************************************/
  public interface UserRepository&lt;T extends UserEntity&gt; extends BaseRepository&lt;UserEntity&gt; {
  
      /* Methods Here */
  
  }
  
  public class UserController&lt;T extends UserEntity&gt; extends BaseController&lt;UserEntity&gt; implements UserRepository&lt;T&gt; {
  
      Class&lt;T&gt; type;
  
      public UserController(Class&lt;T&gt; type) {
          super(type); // &lt;---- Error Here
          this.type = type;
      }
  </code></pre>
  
  <p>Eventually, I will want to have a StudentController, StaffController, etc. inherit from UserController. And BaseController will be the parent to other Controllers (not users). However, I did not know the proper way to go about this. I did try to satisfy</p>
  
  <pre><code>public UserController(Class&lt;T&gt; type) {
          super(type); // &lt;---- Error Here
          this.type = type;
      }
  </code></pre>
  
  <p>replacing "type" in super(type) with UserEntity.class, however that would only allow the Basecontroller to return UserEntity properties. Any solutions? If there is a way...Like I said, I'm still learning and am completely open to other suggestions in approaching this issue or any advice in this particular problem. Much appreciated! Thanks :)</p>