use of org.springframework.data.util.Optionals in project spring-data-commons by spring-projects.
the class RepositoryBeanDefinitionBuilder method registerRepositoryFragmentsImplementation.
private Stream<RepositoryFragmentConfiguration> registerRepositoryFragmentsImplementation(RepositoryConfiguration<?> configuration) {
ClassMetadata classMetadata = getClassMetadata(configuration.getRepositoryInterface());
RepositoryFragmentDiscovery fragmentConfiguration = new DefaultRepositoryFragmentDiscovery(configuration);
return //
Arrays.stream(classMetadata.getInterfaceNames()).filter(//
it -> FragmentMetadata.isCandidate(it, metadataReaderFactory)).map(//
it -> FragmentMetadata.of(it, fragmentConfiguration)).map(//
it -> detectRepositoryFragmentConfiguration(it, configuration.getConfigurationSource())).flatMap(//
Optionals::toStream).peek(//
it -> potentiallyRegisterFragmentImplementation(configuration, it)).peek(it -> potentiallyRegisterRepositoryFragment(configuration, it));
}
use of org.springframework.data.util.Optionals 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