title: Error "cannot be resolved to a type" using the Factory Method
body: <p>I'm trying to use the design pattern "Factory Method" on DAO. There are some problems with the type resolving when I call the method to create the correct instance.
  This is the main where I call the method and I get the error:</p>
  
  <pre><code>public class Main {
  
      public static void main(String[] args){
          int scelta=1;
  
          Parametri&lt;InterfacciaTO&gt; p=new Parametri&lt;InterfacciaTO&gt;();
          //here I get the error
          DaoInterface dao=(DaoInterface) new MySqlDAO.getInstance(scelta,p);
      }
  }
  </code></pre>
  
  <p>These are the classes that I use to implement the FactoryMethod.</p>
  
  <pre><code>public interface DaoFactory {
  
      public abstract Object getInstance(int code,Parametri&lt;InterfacciaTO&gt; param);
  
  }
  
  public  class MySqlDAO implements DaoFactory {
  
      @Override
      public DaoInterface getInstance(int code, Parametri&lt;InterfacciaTO&gt; param) {
          switch(code){
          case Indici.UTENTEDAO: return new UtenteDAO();
          }
          return null;
      }   
  }
  
  public interface DaoInterface {
  
      public abstract void create(int code,Parametri&lt;InterfacciaTO&gt; param);
  
      public abstract void delete(int code,Parametri&lt;InterfacciaTO&gt; param);
  
      public abstract void update(int code,Parametri&lt;InterfacciaTO&gt; param);
  
      public abstract void search(int code,Parametri&lt;InterfacciaTO&gt; param);
  
  }
  
  public class UtenteDAO implements DaoInterface {
  
      @Override
      public void create(int code, Parametri&lt;InterfacciaTO&gt; param) {
          System.out.println("CIAU");
  
      }
  
      @Override
      public void delete(int code, Parametri&lt;InterfacciaTO&gt; param) {
          // TODO Auto-generated method stub
  
      }
  
      @Override
      public void update(int code, Parametri&lt;InterfacciaTO&gt; param) {
          // TODO Auto-generated method stub
  
      }
  
      @Override
      public void search(int code, Parametri&lt;InterfacciaTO&gt; param) {
          // TODO Auto-generated method stub
  
      }
  }
  </code></pre>