Search in sources :

Example 1 with RepositoryFragment

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

the class CdiRepositoryBean method getRepositoryFragments.

private RepositoryFragments getRepositoryFragments(Class<T> repositoryType, CdiRepositoryConfiguration cdiRepositoryConfiguration) {
    Optional<Bean<?>> customImplementationBean = getCustomImplementationBean(repositoryType, cdiRepositoryConfiguration);
    Optional<Object> customImplementation = customImplementationBean.map(this::getDependencyInstance);
    List<RepositoryFragment<?>> repositoryFragments = findRepositoryFragments(repositoryType, cdiRepositoryConfiguration);
    RepositoryFragments customImplementationFragment = // 
    customImplementation.map(// 
    RepositoryFragments::just).orElseGet(RepositoryFragments::empty);
    return // 
    RepositoryFragments.from(repositoryFragments).append(customImplementationFragment);
}
Also used : RepositoryFragments(org.springframework.data.repository.core.support.RepositoryComposition.RepositoryFragments) RepositoryFragment(org.springframework.data.repository.core.support.RepositoryFragment) Bean(javax.enterprise.inject.spi.Bean)

Aggregations

Bean (javax.enterprise.inject.spi.Bean)1 RepositoryFragments (org.springframework.data.repository.core.support.RepositoryComposition.RepositoryFragments)1 RepositoryFragment (org.springframework.data.repository.core.support.RepositoryFragment)1