KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > appfuse > dao > Dao


1 package org.appfuse.dao;
2
3 import java.io.Serializable JavaDoc;
4 import java.util.List JavaDoc;
5
6
7 /**
8  * Data Access Object (Dao) interface. This is an interface
9  * used to tag our Dao classes and to provide common methods to all Daos.
10  *
11  * <p><a HREF="Dao.java.htm"><i>View Source</i></a></p>
12  *
13  * @author <a HREF="mailto:matt@raibledesigns.com">Matt Raible</a>
14  */

15 public interface Dao {
16
17     /**
18      * Generic method used to get all objects of a particular type. This
19      * is the same as lookup up all rows in a table.
20      * @param clazz the type of objects (a.k.a. while table) to get data from
21      * @return List of populated objects
22      */

23     public List JavaDoc getObjects(Class JavaDoc clazz);
24     
25     /**
26      * Generic method to get an object based on class and identifier. An
27      * ObjectRetrievalFailureException Runtime Exception is thrown if
28      * nothing is found.
29      *
30      * @param clazz model class to lookup
31      * @param id the identifier (primary key) of the class
32      * @return a populated object
33      * @see org.springframework.orm.ObjectRetrievalFailureException
34      */

35     public Object JavaDoc getObject(Class JavaDoc clazz, Serializable JavaDoc id);
36
37     /**
38      * Generic method to save an object - handles both update and insert.
39      * @param o the object to save
40      */

41     public void saveObject(Object JavaDoc o);
42
43     /**
44      * Generic method to delete an object based on class and id
45      * @param clazz model class to lookup
46      * @param id the identifier (primary key) of the class
47      */

48     public void removeObject(Class JavaDoc clazz, Serializable JavaDoc id);
49 }
Popular Tags