我正在和老师争论这是否是工厂模式。我可以得到一些你们的意见吗?
public class UrlFactory {
private static boolean testMode;
private static long testDate;
public static URLConnection fetchConnection(String url)
throws IOException
{
URL address = new URL(url);
if(testMode)
return new MockURLConnection(address, testDate);
return address.openConnection();
}
public static void SetTestMode(long testDate)
{
UrlFactory.testMode = true;
UrlFactory.testDate = testDate;
}
public static void UnSetTestMode()
{
UrlFactory.testMode = false;
}
}