it.amattioli.dominate
Class RepositoryRegistry

Show UML class diagram
java.lang.Object
  extended by it.amattioli.dominate.RepositoryRegistry

public class RepositoryRegistry
extends Object

A singleton that can be used to retrieve Repository instances

Author:
andrea

Constructor Summary
RepositoryRegistry()
           
 
Method Summary
<I extends Serializable,T extends Entity<I>>
Repository<I,T>
getRepository(Class<T> c)
          Retrieve a repository for objects of the given class.
<I extends Serializable,T extends Entity<I>>
Repository<I,T>
getRepository(Collection<T> coll)
          Retrieve a collection repository for the given collection.
 RepositoryFactory getRepositoryFactory()
          Return the repository factory object that this registry will use to create the repositories.
 Class<? extends RepositoryFactory> getRepositoryFactoryClass()
          Retrieve the repository factory class the registry will use to create new repository instances.
static RepositoryRegistry instance()
          Retrieve the singleton instance of this class
static void setInstance(RepositoryRegistry newInstance)
          Set the singleton instance that can be retrieved using instance()
 void setRepositoryFactory(RepositoryFactory repositoryFactory)
           
 void setRepositoryFactoryClass(Class<? extends RepositoryFactory> repositoryFactoryClass)
          Set the repository factory class the registry will use to create new repository instances.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepositoryRegistry

public RepositoryRegistry()
Method Detail

instance

public static RepositoryRegistry instance()
Retrieve the singleton instance of this class

Returns:
the singleton instance of this class

setInstance

public static void setInstance(RepositoryRegistry newInstance)
Set the singleton instance that can be retrieved using instance()

Parameters:
newInstance - the instance to be set

getRepositoryFactoryClass

public Class<? extends RepositoryFactory> getRepositoryFactoryClass()
Retrieve the repository factory class the registry will use to create new repository instances.

Returns:
the repository factory the registry will use

setRepositoryFactoryClass

public void setRepositoryFactoryClass(Class<? extends RepositoryFactory> repositoryFactoryClass)
Set the repository factory class the registry will use to create new repository instances.

Parameters:
repositoryFactoryClass - the repository factory the registry will use

getRepositoryFactory

public RepositoryFactory getRepositoryFactory()
Return the repository factory object that this registry will use to create the repositories.

Returns:
the repository factory object that this registry will use to create the repositories

setRepositoryFactory

public void setRepositoryFactory(RepositoryFactory repositoryFactory)

getRepository

public <I extends Serializable,T extends Entity<I>> Repository<I,T> getRepository(Class<T> c)
Retrieve a repository for objects of the given class.

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 repository
Returns:

getRepository

public <I extends Serializable,T extends Entity<I>> Repository<I,T> getRepository(Collection<T> coll)
Retrieve a collection repository for the given collection.

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 collection to be adapted as a repository
Returns:


Copyright © 2011. All Rights Reserved.