Spring Data Commons

org.springframework.data.repository.support
Class Repositories

java.lang.Object
  extended by org.springframework.data.repository.support.Repositories
All Implemented Interfaces:
Iterable<Class<?>>

public class Repositories
extends Object
implements Iterable<Class<?>>

Wrapper class to access repository instances obtained from a ListableBeanFactory.

Author:
Oliver Gierke

Constructor Summary
Repositories(ListableBeanFactory factory)
          Creates a new Repositories instance by looking up the repository instances and meta information from the given ListableBeanFactory.
 
Method Summary
<T,S extends Serializable>
EntityInformation<T,S>
getEntityInformationFor(Class<?> domainClass)
          Returns the EntityInformation for the given domain class.
 List<QueryMethod> getQueryMethodsFor(Class<?> domainClass)
          Returns the QueryMethods contained in the repository managing the given domain class.
<T,S extends Serializable>
CrudRepository<T,S>
getRepositoryFor(Class<?> domainClass)
          Returns the repository managing the given domain class.
 RepositoryInformation getRepositoryInformationFor(Class<?> domainClass)
          Returns the EntityInformation for the given domain class.
 boolean hasRepositoryFor(Class<?> domainClass)
          Returns whether we have a repository instance registered to manage instances of the given domain class.
 Iterator<Class<?>> iterator()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Repositories

public Repositories(ListableBeanFactory factory)
Creates a new Repositories instance by looking up the repository instances and meta information from the given ListableBeanFactory.

Parameters:
factory - must not be null.
Method Detail

hasRepositoryFor

public boolean hasRepositoryFor(Class<?> domainClass)
Returns whether we have a repository instance registered to manage instances of the given domain class.

Parameters:
domainClass - must not be null.
Returns:

getRepositoryFor

public <T,S extends Serializable> CrudRepository<T,S> getRepositoryFor(Class<?> domainClass)
Returns the repository managing the given domain class.

Parameters:
domainClass - must not be null.
Returns:

getEntityInformationFor

public <T,S extends Serializable> EntityInformation<T,S> getEntityInformationFor(Class<?> domainClass)
Returns the EntityInformation for the given domain class.

Parameters:
domainClass - must not be null.
Returns:

getRepositoryInformationFor

public RepositoryInformation getRepositoryInformationFor(Class<?> domainClass)
Returns the EntityInformation for the given domain class.

Parameters:
domainClass - must not be null.
Returns:
the EntityInformation for the given domain class or null if no repository registered for this domain class.

getQueryMethodsFor

public List<QueryMethod> getQueryMethodsFor(Class<?> domainClass)
Returns the QueryMethods contained in the repository managing the given domain class.

Parameters:
domainClass - must not be null.
Returns:

iterator

public Iterator<Class<?>> iterator()
Specified by:
iterator in interface Iterable<Class<?>>

Spring Data Commons

Copyright © 2012. All Rights Reserved.