View Javadoc

1   package com.panogenesis.dao;
2   
3   import java.io.Serializable;
4   import java.util.List;
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.html"><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 getObjects(Class 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 getObject(Class clazz, Serializable 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 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 clazz, Serializable id);
49  }