首页>代码>java swing开发进销存管理系统>/进销存项目/project/src/com/njue/mis/common/CommonFactory.java
/**
 * 工厂类,产生各个服务类的对象
 */
package com.njue.mis.common;

import com.njue.mis.handler.CustomerServicesHandler;
import com.njue.mis.handler.GoodsServicesHandler;
import com.njue.mis.handler.OperatorServicesHandler;
import com.njue.mis.handler.PortInServicesHandle;
import com.njue.mis.handler.PortOutServicesHandle;
import com.njue.mis.handler.ProviderServicesHandler;
import com.njue.mis.handler.SalesBackServicesHandler;
import com.njue.mis.handler.SalesInServicesHandler;

public class CommonFactory
{
	/**
	 * 获取GoodsService类的对象
	 * @return GoodsService类的对象
	 */
	public static GoodsServicesHandler getGoodsServices()
	{
		try
		{
			return (GoodsServicesHandler)Class.forName(Constants.GOODS_SERVICES_CLASS).newInstance();
		}
		catch (Exception e)
		{
			ErrorManager.printError("CommontFactory.getGoodsServices", e);
		}
		return null;
	}
	
	/**
	 * 获取CustomerServices类的对象
	 * @return CustomerServices类的对象
	 */
	public static CustomerServicesHandler getCustomerServices()
	{
		try
		{
			return (CustomerServicesHandler)Class.forName(Constants.CUSTOMER_SERVICES_CLASS).newInstance();
		}
		catch (Exception e)
		{
			ErrorManager.printError("CommontFactory.getCustomerServices", e);
		}
		return null;
	}
	/**
	 * 获取ProviderServices类的对象
	 * @return ProviderServices类的对象
	 */
	public static ProviderServicesHandler getProviderServices()
	{
		try
		{
			return (ProviderServicesHandler)Class.forName(Constants.PROVIDER_SERVICES_CLASS).newInstance();
		}
		catch (Exception e)
		{
			ErrorManager.printError("CommontFactory.getProviderServices", e);
		}
		return null;
	}
	/**
	 * 获取OperatorServices类的对象
	 * @return OperatorServices类的对象
	 */
	public static OperatorServicesHandler getOperatorServices()
	{
		try
		{
			return (OperatorServicesHandler)Class.forName(Constants.OPERATOR_SERVICES_CLASS).newInstance();
		}
		catch (Exception e)
		{
			ErrorManager.printError("CommontFactory.getOperatorServices", e);
		}
		return null;
	}
	/**
	 * 获取PortInServices类的对象
	 * @return PortInServices类的对象
	 */
	public static PortInServicesHandle getPortInServices()
	{
		try
		{
			return (PortInServicesHandle)Class.forName(Constants.PORTIN_SERVICES_CLASS).newInstance();
		}
		catch (Exception e)
		{
			ErrorManager.printError("CommontFactory.PortInServicesHandle", e);
		}
		return null;
	}
	/**
	 * 获取PortOutServices类的对象
	 * @return PortOutServices类的对象
	 */
	public static PortOutServicesHandle getPortOutServices()
	{
		try
		{
			return (PortOutServicesHandle)Class.forName(Constants.PORTOUT_SERVICES_CLASS).newInstance();
		}
		catch (Exception e)
		{
			ErrorManager.printError("CommontFactory.getPortOutServices", e);
		}
		return null;
	}
	
	/**
	 * 获取SalesBackServices类的对象
	 * @return SalesBackServices类的对象
	 */
	public static SalesInServicesHandler getSalesInServices()
	{
		try
		{
			return (SalesInServicesHandler)Class.forName(Constants.SALESIN_SERVICES_CLASS).newInstance();
		}
		catch (Exception e)
		{
			ErrorManager.printError("CommontFactory.SalesInServicesHandler", e);
		}
		return null;
	}
	/**
	 * 获取SalesBackServices类的对象
	 * @return SalesBackServices类的对象
	 */
	public static SalesBackServicesHandler getSalesBackServices()
	{
		try
		{
			return (SalesBackServicesHandler)Class.forName(Constants.SALESBACK_SERVICES_CLASS).newInstance();
		}
		catch (Exception e)
		{
			ErrorManager.printError("CommontFactory.getSalesBackServices", e);
		}
		return null;
	}
}
最近下载更多
yifeng868  LV8 4月15日
woshixiaomu  LV2 2024年1月2日
小学僧  LV1 2023年12月24日
zcfhh1  LV2 2023年10月3日
ds9009  LV8 2023年6月26日
zzz9985688  LV10 2023年6月13日
陈小灏  LV18 2023年2月27日
zyq_html  LV2 2022年12月30日
jehdbhhh  LV1 2022年12月20日
petrichor06  LV1 2022年11月30日
最近浏览更多
519506215  LV1 4月16日
yifeng868  LV8 4月15日
pxqtsht  LV16 2月21日
微信网友_5963854197018624  LV7 2024年5月3日
frank2024 2024年1月28日
暂无贡献等级
codeshare  LV3 2024年1月3日
woshixiaomu  LV2 2024年1月2日
小学僧  LV1 2023年12月24日
LTPR66  LV1 2023年11月28日
xp95323  LV15 2023年11月27日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友