org.apache.commons.mapper
Class MapperAdapter

java.lang.Object
  extended by org.apache.commons.mapper.MapperAdapter
All Implemented Interfaces:
Mapper

public class MapperAdapter
extends Object
implements Mapper

A default implementation of the Mapper interface that throws UnsupportedOperationExceptions for all methods. This makes it easy to define an anonymous inner class Mapper implementation.


Constructor Summary
MapperAdapter()
          Default constructor for MapperAdapter.
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapperAdapter

public MapperAdapter()
Default constructor for MapperAdapter.

Method Detail

create

public Object create(Object object)
              throws MapperException
Description copied from interface: Mapper
Create the given object in a persistent data store. The Mapper should document what type of Object is expected.

Specified by:
create in interface Mapper
Returns:
Object the created object's unique id.
Throws:
MapperException
See Also:
Mapper.create(java.lang.Object)

findByUniqueId

public Object findByUniqueId(Object id)
                      throws MapperException
Description copied from interface: Mapper
Find the given Object based on its unique identifier. This could be a primary key for relational database backends or an ID field in an XML file for XML implementations. The Mapper should document what type of object is expected and what type it returns.

Specified by:
findByUniqueId in interface Mapper
Parameters:
id - An Object that represents a unique ID or a container for composite key values.
Returns:
Object a single object with the given id or null if none found
Throws:
MapperException
See Also:
Mapper.findByUniqueId(java.lang.Object)

delete

public void delete(Object object)
            throws MapperException
Description copied from interface: Mapper
Remove an object from the data store.

Specified by:
delete in interface Mapper
Throws:
MapperException
See Also:
Mapper.delete(java.lang.Object)

update

public void update(Object object)
            throws MapperException
Description copied from interface: Mapper
Update the given object in the data store.

Specified by:
update in interface Mapper
Throws:
MapperException
See Also:
Mapper.update(java.lang.Object)

findAllObjects

public Collection findAllObjects()
                          throws MapperException
Description copied from interface: Mapper
Returns a Collection of all objects for the given mapper.

Specified by:
findAllObjects in interface Mapper
Throws:
MapperException
See Also:
Mapper.findAllObjects()


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.