|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Mapper
A Mapper is responsible for mapping domain objects to a persistent data store. By removing this functionality from the domain objects, the backend datastore implementation is allowed to change without affecting any domain objects. Examples of Mapper implementations include JdbcMapper, EjbMapper, and JdoMapper which store data using their respective technologies.
Additionally, Mappers decouple your application from the underlying mapping technology. You might use JdbcMappers for a small website and then migrate to EjbMappers as the site grows without your application code changing.
Mapper implementations should not use instance variables to maintain state because they will be run in a multi-threaded environment. The MapperFactory will return the same instance of a Mapper every time it's requested. Mappers should use local method variables and method parameters to maintain thread safety.
Mapper is equivalent to the concept of a data access object (DAO).
MapperFactory
Method Summary | |
---|---|
Object |
create(Object object)
Create the given object in a persistent data store. |
void |
delete(Object object)
Remove an object from the data store. |
Collection |
findAllObjects()
Returns a Collection of all objects for the given mapper. |
Object |
findByUniqueId(Object id)
Find the given Object based on its unique identifier. |
void |
update(Object object)
Update the given object in the data store. |
Method Detail |
---|
Object create(Object object) throws MapperException
MapperException
UnsupportedOperationException
- if this mapper doesn't support this
method.Object findByUniqueId(Object id) throws MapperException
id
- An Object that represents a unique ID or a container for
composite key values.
MapperException
UnsupportedOperationException
- if this mapper doesn't support this
method.void delete(Object object) throws MapperException
MapperException
UnsupportedOperationException
- if this mapper doesn't support this
method.void update(Object object) throws MapperException
MapperException
UnsupportedOperationException
- if this mapper doesn't support this
method.Collection findAllObjects() throws MapperException
MapperException
UnsupportedOperationException
- if this mapper doesn't support this
method.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |