use of org.springframework.data.repository.config.RepositoryFragmentConfiguration 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);
}
use of org.springframework.data.repository.config.RepositoryFragmentConfiguration in project spring-data-commons by spring-projects.
the class CdiRepositoryContext method detectRepositoryFragmentConfiguration.
private Optional<RepositoryFragmentConfiguration> detectRepositoryFragmentConfiguration(FragmentMetadata configuration) {
String className = configuration.getFragmentImplementationClassName();
Optional<AbstractBeanDefinition> beanDefinition = detector.detectCustomImplementation(className, null, configuration.getBasePackages(), configuration.getExclusions(), BeanDefinition::getBeanClassName);
return beanDefinition.map(bd -> new RepositoryFragmentConfiguration(configuration.getFragmentInterfaceName(), bd));
}
Aggregations