it.amattioli.dominate.repositories
Class AbstractRepositoryFactory

Show UML class diagram
java.lang.Object
  extended by it.amattioli.dominate.repositories.AbstractRepositoryFactory
All Implemented Interfaces:
RepositoryFactory
Direct Known Subclasses:
HibernateRepositoryFactory, MemoryRepositoryFactory

public abstract class AbstractRepositoryFactory
extends Object
implements RepositoryFactory

This implementation of RepositoryFactory tries to find a custom factory method for the repository of the given class. If it cannot find such a method it will revert to a default repository. The custom factory method for a repository of class MyClass must be called getMyClassRepository().

Author:
andrea

Constructor Summary
AbstractRepositoryFactory()
           
 
Method Summary
protected abstract
<I extends Serializable,T extends Entity<I>>
Repository<I,T>
getDefaultRepository(Class<T> c)
          Create a default repository for objects of class c.
<I extends Serializable,T extends Entity<I>>
Repository<I,T>
getRepository(Class<T> c)
          Create a repository for objects of the given class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface it.amattioli.dominate.RepositoryFactory
getRepository
 

Constructor Detail

AbstractRepositoryFactory

public AbstractRepositoryFactory()
Method Detail

getRepository

public <I extends Serializable,T extends Entity<I>> Repository<I,T> getRepository(Class<T> c)
Description copied from interface: RepositoryFactory
Create a repository for objects of the given class.

Specified by:
getRepository in interface RepositoryFactory
Type Parameters:
I - The class of the id of the objects contained in the constructed repository
T - The class of the objects contained in the constructed repository
Parameters:
c - The class object of the objects contained in the constructed repository
Returns:
a new repository for objects of class c or null if this repositoryFactory cannot create a repository for the given class

getDefaultRepository

protected abstract <I extends Serializable,T extends Entity<I>> Repository<I,T> getDefaultRepository(Class<T> c)
Create a default repository for objects of class c. This method is called by getRepository(Class) if it cannot find a custom factory method

Type Parameters:
I -
T -
Parameters:
c -
Returns:


Copyright © 2011. All Rights Reserved.