use of org.springframework.data.repository.config.RepositoryFragmentDiscovery in project spring-data-commons by spring-projects.
the class CdiRepositoryContext method getRepositoryFragments.
/**
* Discover {@link RepositoryFragmentConfiguration fragment configurations} for a {@link Class repository interface}.
*
* @param configuration must not be {@literal null}.
* @param repositoryInterface must not be {@literal null}.
* @return {@link Stream} of {@link RepositoryFragmentConfiguration fragment configurations}.
*/
Stream<RepositoryFragmentConfiguration> getRepositoryFragments(CdiRepositoryConfiguration configuration, Class<?> repositoryInterface) {
ClassMetadata classMetadata = getClassMetadata(metadataReaderFactory, repositoryInterface.getName());
RepositoryFragmentDiscovery fragmentConfiguration = new CdiRepositoryFragmentDiscovery(configuration);
return //
Arrays.stream(classMetadata.getInterfaceNames()).filter(//
it -> FragmentMetadata.isCandidate(it, metadataReaderFactory)).map(//
it -> FragmentMetadata.of(it, fragmentConfiguration)).map(//
this::detectRepositoryFragmentConfiguration).flatMap(Optionals::toStream);
}
Aggregations