moviedaofactory.java

来自「java编程中的DAO模式举例,其他人不需帐号就可自由下载此源码」· Java 代码 · 共 62 行

JAVA
62
字号
// $Header: /cvsroot/daoexamples/daoexamples/src/java/daoexamples/movie/MovieDAOFactory.java,v 1.6 2003/08/13 04:16:18 sullis Exp $
 
/*
 * 
 *
 * 
 * 
 */
 
package daoexamples.movie;

/**
 * <p>
 * Normally, a DAO factory class contains 
 * only one public "getFooDAO" method. This class provides 
 * two "get" methods because we want this factory to expose 
 * both of the {@link MovieDAO} implementations. 
 * </p>
 * 
 * @author Sean C. Sullivan
 *
 */
public final class MovieDAOFactory
{
	private MovieDAOFactory()
	{
		// this constructor is intentionally private
	}

	/**
	 * 
	 * 
	 * @return a non-null value. The DAO returned by this
	 *            method uses JDBC transactions. The DAO 
	 *            demaractes transactions internally.
	 *  
	 * @see #getMovieDAO_JTA()
	 * 
	 * 
	 */
	public static MovieDAO getMovieDAO()
	{
		return new MovieDAOImpl();
	}

	/**
	 * 
	 * @return a non-null value. The DAO returned by this
	 *         method assumes that the caller is using JTA 
	 *         transactions. Transactions are demarcated external 
	 *         to the DAO.
	 *  
	 * @see #getMovieDAO()
	 * 
	 */
	public static MovieDAO getMovieDAO_JTA()
	{
		return new MovieDAOImplJTA();
	}
	
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?