title: Specify object type of a returned array list dynamically
body: <p>I have following class which takes an interface and execute some functions:</p>
  
  <pre><code>public class MSSQLHandler {
  
      IMSSQLStatement statement;
  
      public MSSQLHandler(IMSSQLStatement statement) {
          this.statement = statement;
      }
  
      public void invoke() throws SQLException {
          statement.executeStatement();
      }
  
      public List&lt;?&gt; getDataList() throws SQLException {
          return statement.getDataList();
      }
  }
  </code></pre>
  
  <p>The interface is implemented by an abstract class:</p>
  
  <pre><code>public abstract class MSSQLStatement implements IMSSQLStatement {
  
      protected Connection conn = null;
      protected ResultSet rs = null;
  
      protected abstract String createStatement() throws SQLSyntaxErrorException;
  
      public MSSQLStatement(Connection conn) {    
         this.conn = conn;
      }
  
      public void executeStatement() throws SQLException {    
         Statement st = conn.createStatement();
         String sql = createStatement();
         if(sql != null) {
            rs = st.executeQuery(createStatement());
         } else {
            throw new SQLException("Method 'createStatement()' has to be implemented.");
         }
      }    
  }
  </code></pre>
  
  <p>The class (or the interface) which is passed to the handler class extend the abstract class from above:</p>
  
  <pre><code>public class MSSQLTaskStatement extends MSSQLStatement {
  
      public MSSQLTaskStatement(Connection conn) {
      super(conn);
      }
  
      private String projectName = null;
  
      public void setProjectName(String projectName) {
      this.projectName = projectName;
      }
  
      protected String createStatement() throws SQLSyntaxErrorException {
        // Create SQL query
      }
  
      @Override
      public List&lt;MyObjectData&gt; getDataList() throws SQLException {
        // Wrap results into a data object and save it to an array list
        List&lt;MyObjectData&gt; l = new ArrayList&lt;MyObjectData&gt;()
        while(rs.next()) {
           MyObjectData o = new MyObjectData();
           o.setColumn1(rs.getString(1))
           l.add(o);
        }
        return l;
      }
  }
  </code></pre>
  
  <p>The question is whether it is possible to pass the object type (<code>MyObjectData</code>) of the returned list of the overridden <code>getDataList()</code> method from the class <code>MSSQLTaskStatement</code> to the handler class <code>public List&lt;?&gt; getDataList() throws SQLException</code> method ?</p>
  
  <p>Best Regards,
  Sandro</p>