DATACMNS-90 - Polishing.
Added missing author tags where needed. Removed the template method to pick up the configuration from the RepositoryConfigurationSource interface as it's not needed from the outside. Original pull request: #50.
This commit is contained in:
@@ -39,6 +39,7 @@ import org.springframework.util.StringUtils;
|
||||
* Annotation based {@link RepositoryConfigurationSource}.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Thomas Darimont
|
||||
*/
|
||||
public class AnnotationRepositoryConfigurationSource extends RepositoryConfigurationSourceSupport {
|
||||
|
||||
@@ -224,11 +225,12 @@ public class AnnotationRepositoryConfigurationSource extends RepositoryConfigura
|
||||
return typeFilters;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.config.RepositoryConfigurationSourceSupport#isConsideringNestedRepositoriesEnabled()
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.config.RepositoryConfigurationSourceSupport#shouldConsiderNestedRepositories()
|
||||
*/
|
||||
@Override
|
||||
public boolean isConsideringNestedRepositoriesEnabled() {
|
||||
public boolean shouldConsiderNestedRepositories() {
|
||||
return attributes.getBoolean(CONSIDER_NESTED_REPOSITORIES);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,9 +77,4 @@ public interface RepositoryConfigurationSource {
|
||||
* @return
|
||||
*/
|
||||
Collection<String> getCandidates(ResourceLoader loader);
|
||||
|
||||
/**
|
||||
* @return true if the container should look for nested repository interface definitions.
|
||||
*/
|
||||
boolean isConsideringNestedRepositoriesEnabled();
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.springframework.core.type.filter.TypeFilter;
|
||||
* Base class to implement {@link RepositoryConfigurationSource}s.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Thomas Darimont
|
||||
*/
|
||||
public abstract class RepositoryConfigurationSourceSupport implements RepositoryConfigurationSource {
|
||||
|
||||
@@ -54,7 +55,7 @@ public abstract class RepositoryConfigurationSourceSupport implements Repository
|
||||
public Collection<String> getCandidates(ResourceLoader loader) {
|
||||
|
||||
RepositoryComponentProvider scanner = new RepositoryComponentProvider(getIncludeFilters());
|
||||
scanner.setConsiderNestedRepositoryInterfaces(isConsideringNestedRepositoriesEnabled());
|
||||
scanner.setConsiderNestedRepositoryInterfaces(shouldConsiderNestedRepositories());
|
||||
scanner.setResourceLoader(loader);
|
||||
scanner.setEnvironment(environment);
|
||||
|
||||
@@ -95,8 +96,12 @@ public abstract class RepositoryConfigurationSourceSupport implements Repository
|
||||
}
|
||||
|
||||
/**
|
||||
* Controls whether nested repository-interfaces (e.g. defined as inner classes) should be considered by the
|
||||
* repository infrastructure.
|
||||
* Returns whether we should consider nested repositories, i.e. repository interface definitions nested in other
|
||||
* classes.
|
||||
*
|
||||
* @return {@literal true} if the container should look for nested repository interface definitions.
|
||||
*/
|
||||
public abstract boolean isConsideringNestedRepositoriesEnabled();
|
||||
public boolean shouldConsiderNestedRepositories() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,11 +151,12 @@ public class XmlRepositoryConfigurationSource extends RepositoryConfigurationSou
|
||||
return StringUtils.hasText(attribute) ? attribute : null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.config.RepositoryConfigurationSourceSupport#isConsideringNestedRepositoriesEnabled()
|
||||
*/
|
||||
@Override
|
||||
public boolean isConsideringNestedRepositoriesEnabled() {
|
||||
public boolean shouldConsiderNestedRepositories() {
|
||||
|
||||
String attribute = getNullDefaultedAttribute(element, CONSIDER_NESTED_REPOSITORIES);
|
||||
return attribute != null && Boolean.parseBoolean(attribute);
|
||||
|
||||
@@ -66,19 +66,19 @@ public class AnnotationRepositoryConfigurationSourceUnitTests {
|
||||
public void defaultsToPackageOfAnnotatedClass() {
|
||||
|
||||
AnnotationMetadata metadata = new StandardAnnotationMetadata(DefaultConfiguration.class);
|
||||
RepositoryConfigurationSource source = new AnnotationRepositoryConfigurationSource(metadata,
|
||||
AnnotationRepositoryConfigurationSource source = new AnnotationRepositoryConfigurationSource(metadata,
|
||||
EnableRepositories.class, environment);
|
||||
|
||||
Iterable<String> packages = source.getBasePackages();
|
||||
assertThat(packages, hasItem(DefaultConfiguration.class.getPackage().getName()));
|
||||
assertThat(source.isConsideringNestedRepositoriesEnabled(), is(false));
|
||||
assertThat(source.shouldConsiderNestedRepositories(), is(false));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void returnsConfiguredBasePackage() {
|
||||
|
||||
AnnotationMetadata metadata = new StandardAnnotationMetadata(DefaultConfigurationWithBasePackage.class);
|
||||
RepositoryConfigurationSource source = new AnnotationRepositoryConfigurationSource(metadata,
|
||||
AnnotationRepositoryConfigurationSource source = new AnnotationRepositoryConfigurationSource(metadata,
|
||||
EnableRepositories.class, environment);
|
||||
|
||||
Iterable<String> packages = source.getBasePackages();
|
||||
@@ -92,10 +92,10 @@ public class AnnotationRepositoryConfigurationSourceUnitTests {
|
||||
public void returnsConsiderNestedRepositories() {
|
||||
|
||||
AnnotationMetadata metadata = new StandardAnnotationMetadata(DefaultConfigurationWithNestedRepositories.class);
|
||||
RepositoryConfigurationSource source = new AnnotationRepositoryConfigurationSource(metadata,
|
||||
AnnotationRepositoryConfigurationSource source = new AnnotationRepositoryConfigurationSource(metadata,
|
||||
EnableRepositories.class, environment);
|
||||
|
||||
assertThat(source.isConsideringNestedRepositoriesEnabled(), is(true));
|
||||
assertThat(source.shouldConsiderNestedRepositories(), is(true));
|
||||
}
|
||||
|
||||
public static class Person {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012 the original author or authors.
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -33,9 +33,10 @@ import org.springframework.oxm.jaxb.Jaxb2Marshaller;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
|
||||
/**
|
||||
* Integration tests for the initializer name-space elements.
|
||||
* Integration tests for the initializer namespace elements.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Thomas Darimont
|
||||
*/
|
||||
public class ResourceReaderRepositoryPopulatorBeanDefinitionParserIntegrationTests {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user