Skip to content

Instantly share code, notes, and snippets.

@mraible
Created October 23, 2009 00:30
Show Gist options
  • Save mraible/216495 to your computer and use it in GitHub Desktop.
Save mraible/216495 to your computer and use it in GitHub Desktop.
package org.appfuse.gwt.client.service;
import java.io.Serializable;
/**
* Generic Services to allow easily creating GWT services.
*
* @author mraible
* @param <T> a type variable
* @param <PK> the primary key for that type
*/
public interface GenericService<T, PK extends Serializable> {
/**
* Generic method used to get all objects of a particular type. This
* is the same as lookup up all rows in a table.
*/
void getAll();
/**
* Generic method to get an object based on identifier.
*
* @param id the identifier (primary key) of the object to get
*/
void get(PK id);
/**
* Generic method to save an object - handles both update and insert.
* @param object the object to save
*/
void save(T object);
/**
* Generic method to delete an object based on id
* @param id the identifier (primary key) of the object to delete
*/
void delete(PK id);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment