1 /*
2 * EL4J, the Extension Library for the J2EE, adds incremental enhancements to
3 * the spring framework, http://el4j.sf.net
4 * Copyright (C) 2006 by ELCA Informatique SA, Av. de la Harpe 22-24,
5 * 1000 Lausanne, Switzerland, http://www.elca.ch
6 *
7 * EL4J is published under the GNU Lesser General Public License (LGPL)
8 * Version 2.1. See http://www.gnu.org/licenses/
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * For alternative licensing, please contact info@elca.ch
16 */
17 package ch.elca.el4j.services.persistence.generic.dao;
18
19 import java.util.Map;
20
21 /**
22 * A registry for DAOs.
23 *
24 * @svnLink $Revision: 4071 $;$Date: 2010-01-06 10:07:00 +0100 (Mi, 06. Jan 2010) $;$Author: jonasha $;$URL: https://el4j.svn.sourceforge.net/svnroot/el4j/branches/el4j_3_1/el4j/framework/modules/core/src/main/java/ch/elca/el4j/services/persistence/generic/dao/DaoRegistry.java $
25 *
26 * @author Adrian Moos (AMS)
27 * @author Alex Mathey (AMA)
28 * @author Jonas Hauenstein (JHN)
29 */
30 public interface DaoRegistry {
31
32 /**
33 * Returns the generic DAO for entities of type {@code entityType}.
34 *
35 * @param <T> The domain class type.
36 * @param entityType
37 * The domain class for which a generic DAO should be returned.
38 * The class does some basic handling to tolerate (i.e. unwrap)
39 * Spring proxies.
40 * @return A fully generic or partially specific DAO for the given type,
41 * or null if none was found.
42 */
43 public <T> GenericDao<T> getFor(Class<T> entityType);
44
45 /**
46 * Returns the DAO of a given type.
47 * If no DAO of the given type is registered, null will be returned.
48 *
49 * @param <T> The DOA class type.
50 * @param doaType The DAO class type for which the DAO should be returned.
51 * @return The DAO for the given type or null.
52 */
53 public <T> T getDao(Class<T> doaType);
54
55 /**
56 * @return Returns the registered DAOs.
57 */
58 public Map<Class<?>, ? extends GenericDao<?>> getDaos();
59
60 }