public class RepositoryFactory extends Object
repository instances.
Uses a static and a local cache to prevent from double allocations.
Works in a multi-threaded environment with different services running at the same time.| Constructor and Description |
|---|
RepositoryFactory(Service service) |
| Modifier and Type | Method and Description |
|---|---|
Collection<Repository> |
cache()
Return all currently cached
repositories. |
Repository |
get(Class modelClass)
|
Repository |
get(String name)
Get the
repository for the model with a specific name. |
void |
register(String name,
Repository repository)
Register a new
repository manually. |
Collection<Class> |
repositoryClasses()
Return all currently cached
repository classes. |
void |
setRepositoryService(Repository repository) |
public RepositoryFactory(Service service)
public Collection<Class> repositoryClasses()
repository classes.public Collection<Repository> cache()
repositories.public Repository get(Class modelClass)
modelClass - Model class used to lookup the repositorypublic Repository get(String name)
repository for the model with a specific name.name - Model name used to lookup the repositorypublic void setRepositoryService(Repository repository) throws ReflectiveOperationException
ReflectiveOperationExceptionpublic void register(String name, Repository repository)
repository manually. It should not be neccessary to call
this under normal circumstances. Use the service registry instead.name - Model name used in the repositoryrepository - Repository to add to the cacheCopyright © 2018. All rights reserved.