it.amattioli.dominate.hibernate
Class HibernateRepositoryFactory

Show UML class diagram
java.lang.Object
  extended by it.amattioli.dominate.repositories.AbstractRepositoryFactory
      extended by it.amattioli.dominate.hibernate.HibernateRepositoryFactory
All Implemented Interfaces:
RepositoryFactory

public class HibernateRepositoryFactory
extends AbstractRepositoryFactory

Creates a ClassHibernateRepository for objects of the given class if this class is mapped with Hibernate. If the given class is not mapped with Hibernate the AbstractRepositoryFactory.getRepository(Class) method will return null.

As this class extends AbstractRepositoryFactory it will first look for a custom factory method before trying to instantiate a default repository.

Author:
andrea

Constructor Summary
HibernateRepositoryFactory()
           
 
Method Summary
<I extends Serializable,T extends Entity<I>>
Repository<I,T>
cloneRepository(AbstractHibernateRepository<I,T> rep)
           
protected
<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(Collection<T> coll)
          Create an adapter that present the given collection as a repository.
 
Methods inherited from class it.amattioli.dominate.repositories.AbstractRepositoryFactory
getRepository
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateRepositoryFactory

public HibernateRepositoryFactory()
Method Detail

getRepository

public <I extends Serializable,T extends Entity<I>> Repository<I,T> getRepository(Collection<T> coll)
Description copied from interface: RepositoryFactory
Create an adapter that present the given collection as a repository.

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:
coll - The collection that will be adapted as a repository
Returns:
the newly created repository

getDefaultRepository

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

Specified by:
getDefaultRepository in class AbstractRepositoryFactory
Returns:

cloneRepository

public <I extends Serializable,T extends Entity<I>> Repository<I,T> cloneRepository(AbstractHibernateRepository<I,T> rep)
                                                                       throws CloneNotSupportedException
Throws:
CloneNotSupportedException


Copyright © 2011. All Rights Reserved.