945
技術社區[雲棲]
【設計模式】【工廠方法根據type參數升級為抽象工廠】
/**
* Description:
* <br/>網站: <a href="https://www.crazyit.org">瘋狂Java聯盟</a>
* <br/>Copyright (C), 2001-2012, Yeeku.H.Lee
* <br/>This program is protected by copyright laws.
* <br/>Program Name:
* <br/>Date:
* @author Yeeku.H.Lee kongyeeku@163.com
* @version 1.0
*/
public class OutputFactoryFactory
{
//僅定義一個方法用於返回輸出設備。
public static OutputFactory getOutputFactory(
String type)
{
if (type.equalsIgnoreCase("better"))
{
return new BetterPrinterFactory();
}
else
{
return new PrinterFactory();
}
}
}
最後更新:2017-04-04 07:03:36