Search in sources :

Example 1 with RepositoryFactoryInformation

use of org.springframework.data.repository.core.support.RepositoryFactoryInformation in project spring-data-commons by spring-projects.

the class Repositories method cacheRepositoryFactory.

@SuppressWarnings({ "rawtypes", "unchecked" })
private synchronized void cacheRepositoryFactory(String name) {
    RepositoryFactoryInformation repositoryFactoryInformation = beanFactory.get().getBean(name, RepositoryFactoryInformation.class);
    Class<?> domainType = ClassUtils.getUserClass(repositoryFactoryInformation.getRepositoryInformation().getDomainType());
    RepositoryInformation information = repositoryFactoryInformation.getRepositoryInformation();
    Set<Class<?>> alternativeDomainTypes = information.getAlternativeDomainTypes();
    String beanName = BeanFactoryUtils.transformedBeanName(name);
    Set<Class<?>> typesToRegister = new HashSet<>(alternativeDomainTypes.size() + 1);
    typesToRegister.add(domainType);
    typesToRegister.addAll(alternativeDomainTypes);
    for (Class<?> type : typesToRegister) {
        this.repositoryFactoryInfos.put(type, repositoryFactoryInformation);
        this.repositoryBeanNames.put(type, beanName);
    }
}
Also used : RepositoryFactoryInformation(org.springframework.data.repository.core.support.RepositoryFactoryInformation) RepositoryInformation(org.springframework.data.repository.core.RepositoryInformation) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 RepositoryInformation (org.springframework.data.repository.core.RepositoryInformation)1 RepositoryFactoryInformation (org.springframework.data.repository.core.support.RepositoryFactoryInformation)1