1 //---------------------------------------------------------------------- 2 // 3 // PerfectJPattern: "Design patterns are good but components are better!" 4 // IGenericDaoFactory.java Copyright (c) 2009 Giovanni Azua Garcia 5 // bravegag@hotmail.com 6 // 7 // This program is free software; you can redistribute it and/or 8 // modify it under the terms of the GNU General Public License 9 // as published by the Free Software Foundation; either version 3 10 // of the License, or (at your option) any later version. 11 // 12 // This program is distributed in the hope that it will be useful, 13 // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 // GNU General Public License for more details. 16 // 17 // You should have received a copy of the GNU General Public License 18 // along with this program; if not, see <http://www.gnu.org/licenses/>. 19 // 20 //---------------------------------------------------------------------- 21 package org.perfectjpattern.jee.api.integration.dao; 22 23 import java.io.*; 24 25 /** 26 * Abstract Factory for creating instances of {@link IGenericReadOnlyDao} and 27 * {@link IGenericDao} types 28 * 29 * @author <a href="mailto:bravegag@hotmail.com">Giovanni Azua</a> 30 * @version $ $Date: Dec 5, 2008 5:26:23 PM $ 31 */ 32 public 33 interface IGenericDaoFactory 34 extends IBaseDaoFactory 35 { 36 //------------------------------------------------------------------------ 37 // public 38 //------------------------------------------------------------------------ 39 /** 40 * Returns the Generic Read-Only DAO implementation corresponding to the 41 * given model class type. Provides a generic and reusable means to 42 * create cached DAO instances. 43 * 44 * @param <Id> Id type 45 * @param <Element> Element type 46 * @param aPersistentClass Data model class type 47 * @return Generic DAO implementation corresponding to the given 48 * model class type 49 * @throws IllegalArgumentException 'aPersistentClass' must not be null 50 * @throws IllegalArgumentException 'aPersistentClass' must be a class type 51 */ 52 public <Id extends Serializable, Element> IGenericReadOnlyDao<Id, Element> 53 createReadOnlyDao(Class<Element> aPersistentClass) 54 throws IllegalArgumentException; 55 56 //------------------------------------------------------------------------ 57 /** 58 * Returns the Generic DAO implementation corresponding to the given 59 * model class type. Provides a generic and reusable means to create 60 * cached DAO instances. 61 * 62 * @param <Id> Id type 63 * @param <Element> Element type 64 * @param aPersistentClass Data model class type 65 * @return Generic DAO implementation corresponding to the given 66 * model class type 67 * @throws IllegalArgumentException 'aPersistentClass' must not be null 68 * @throws IllegalArgumentException 'aPersistentClass' must be a class type 69 */ 70 public <Id extends Serializable, Element> IGenericDao<Id, Element> 71 createDao(Class<Element> aPersistentClass) 72 throws IllegalArgumentException; 73 }