我有一个工厂模式的构造函数。我正在传递许多参数。如何重构它。
ServerFactory serverFactory = new ServerFactory();
CalendarResults calResults= serverFactory.getResults(serverName,locale, Day, week,
month,vdate,results,uri, EmailShare, inc, upperLimit,
endLimit,exchWD, YearMonthDay,WeekMonthDate);
results=calResults.serverNameDay(serverName,locale, Day, week, month,vdate,
results,uri, EmailShare, inc, upperLimit, endLimit, exchWD, YearMonthDay);
public class ServerFactory {
public CalendarResults getResults(String serverName,String locale, String day,
String week, String month,
boolean vdate, ArrayList<CalendarOutput> results, String uri,
List<String> emailShare, int inc, int upperLimit,
int endLimit, NexWebDav exchWD, String yearMonth, boolean
weekMonthDate){
CalendarResults calresults=null;
if(serverName.equals("www.google.com")){
calresults=new Google();
}else{
calresults=new Exchange();
}
return calresults;
}
}