org.springframework.data.repository.support

## Class Repositories

- java.lang.Object
- - 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, Thomas Darimont, Thomas Eizinger, Christoph Strobl

### Constructor Summary

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

### Method Summary

All Methods Instance Methods Concrete Methods
`<T,S> EntityInformation<T,S>` `getEntityInformationFor(Class<?> domainClass)` Returns the `EntityInformation` for the given domain class.
`PersistentEntity<?,?>` `getPersistentEntity(Class<?> domainClass)` Returns the `PersistentEntity` for the given domain class.
`List<QueryMethod>` `getQueryMethodsFor(Class<?> domainClass)` Returns the `QueryMethod`s contained in the repository managing the given domain class.
`Optional<Object>` `getRepositoryFor(Class<?> domainClass)` Returns the repository managing the given domain class.
`Optional<RepositoryInformation>` `getRepositoryInformation(Class<?> repositoryInterface)` Returns the `RepositoryInformation` for the given repository interface.
`Optional<RepositoryInformation>` `getRepositoryInformationFor(Class<?> domainClass)` Returns the `RepositoryInformation` for the given domain class.
`RepositoryInformation` `getRequiredRepositoryInformation(Class<?> domainType)` Returns the `RepositoryInformation` for the given domain type.
`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`

### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`

### 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 Optional<Object> getRepositoryFor(Class<?> domainClass)

Returns the repository managing the given domain class.

Parameters:
  `domainClass` - must not be null.
Returns:

#### getEntityInformationFor

    public <T,S> EntityInformation<T,S> getEntityInformationFor(Class<?> domainClass)

Returns the `EntityInformation` for the given domain class.

Parameters:
  `domainClass` - must not be null.
Returns:

#### getRepositoryInformationFor

    public Optional<RepositoryInformation> getRepositoryInformationFor(Class<?> domainClass)

Returns the `RepositoryInformation` for the given domain class.

Parameters:
  `domainClass` - must not be null.
Returns:
  the `RepositoryInformation` for the given domain class or Optional#empty() if no repository registered for this domain class.

#### getRequiredRepositoryInformation

    public RepositoryInformation getRequiredRepositoryInformation(Class<?> domainType)

Returns the `RepositoryInformation` for the given domain type.

Parameters:
  `domainType` - must not be null.
Returns:
  the `RepositoryInformation` for the given domain type.
Throws:
  `IllegalArgumentException` - in case no `RepositoryInformation` could be found for the given domain type.

#### getRepositoryInformation

    public Optional<RepositoryInformation> getRepositoryInformation(Class<?> repositoryInterface)

Returns the `RepositoryInformation` for the given repository interface.

Parameters:
  `repositoryInterface` - must not be null.
Returns:
  the `RepositoryInformation` for the given repository interface or null there's no repository instance registered for the given interface.
Since:
  1.12

#### getPersistentEntity

    public PersistentEntity<?,?> getPersistentEntity(Class<?> domainClass)

Returns the `PersistentEntity` for the given domain class. Might return null in case the module storing the given domain class does not support the mapping subsystem.

Parameters:
  `domainClass` - must not be null.
Returns:
  the `PersistentEntity` for the given domain class or null if no repository is registered for the domain class or the repository is not backed by a `MappingContext` implementation.

#### getQueryMethodsFor

    public List<QueryMethod> getQueryMethodsFor(Class<?> domainClass)

Returns the `QueryMethod`s 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<?>>`