org.ioc.commons.integration.dataaccess.dao.EntityDao Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ioc-commons Show documentation
Show all versions of ioc-commons Show documentation
This project defines a set of useful java interfaces for helping you in the definition of the structure of your developments in Java-projects which are designed using a Inversion-Of-Control (IOC) pattern. Useful for MVP-Pattern designs in applications coded on GWT, SWT, Android, etc.
package org.ioc.commons.integration.dataaccess.dao;
import org.ioc.commons.integration.common.RequestManager;
/**
* A dao for an entity object.
*
* @author Jesús Lunar Pérez
*
* @param
* Entity object type
* @param
* Identifier type
* @param
* Dao factory type
*/
public interface EntityDao extends Dao {
/**
* The identifier of the entity objects
*
* @param entity
* Entity object
* @return The identifier for the entity object.
*/
I getId(Object entity);
/**
* Find an entity object through its identifier.
*
* @param id
* Unique identifier of the object.
* @return An operation manager for handling this operation.
*/
RequestManager find(I id);
/**
* Creates a new entity object.
*
* Only DAOs under a transaction will return values here; otherwise it will
* throw an exception.
*
* @return new entity object.
*/
T create();
/**
* Edit an entity object
*
* @param entity
* Entity for starting edition
* @return Entity object ready for editing.
*/
T edit(T entity);
/**
* Creates a new secondary object used from the entity. Useful for creating
* object which are not entities but are needed for the entity, such as
* relationship objects that will be set to the entity.
*
* @param class1
* Class of the new secondary object
* @return An instance for a new secondary object.
*/
O create(Class class1);
/**
* It returns a subscriptor for operations made by the DAO
*
* @return Subscriptor
*/
Subscriptor subscriptor();
}