public class SWInfoFactory { private static IInfo info; synchronized public static IInfo getInfo() { if (info == null) { try { Class c = Class.forName("com.sinocec.model.web.eq.Info"); info = (IInfo) c.newInstance(); LogFactory.getLog().info(new SWInfoFactory(), "获取IInfo类成功!"); } catch (Exception e) { LogFactory.getLog().error(new Config(), "获取类 com.sinocec.model.cec.index.IInfo 失败!", e); return null; } } return info; } }
详细解决方案
【简略工厂模式】示例代码
热度:228 发布时间:2013-11-06 16:26:37.0
相关解决方案