Rename ConfigurationClassMethod => BeanMethod
This commit is contained in:
parent
f683f781c5
commit
0a790c143f
|
|
@ -31,14 +31,14 @@ import org.springframework.core.type.MethodMetadata;
|
|||
* @see ConfigurationClassParser
|
||||
* @see ConfigurationClassBeanDefinitionReader
|
||||
*/
|
||||
final class ConfigurationClassMethod {
|
||||
final class BeanMethod {
|
||||
|
||||
private final MethodMetadata metadata;
|
||||
|
||||
private final ConfigurationClass configurationClass;
|
||||
|
||||
|
||||
public ConfigurationClassMethod(MethodMetadata metadata, ConfigurationClass configurationClass) {
|
||||
public BeanMethod(MethodMetadata metadata, ConfigurationClass configurationClass) {
|
||||
this.metadata = metadata;
|
||||
this.configurationClass = configurationClass;
|
||||
}
|
||||
|
|
@ -40,7 +40,7 @@ import org.springframework.util.ClassUtils;
|
|||
* @author Chris Beams
|
||||
* @author Juergen Hoeller
|
||||
* @since 3.0
|
||||
* @see ConfigurationClassMethod
|
||||
* @see BeanMethod
|
||||
* @see ConfigurationClassParser
|
||||
*/
|
||||
final class ConfigurationClass {
|
||||
|
|
@ -51,7 +51,7 @@ final class ConfigurationClass {
|
|||
|
||||
private final Map<String, Class<?>> importedResources = new LinkedHashMap<String, Class<?>>();
|
||||
|
||||
private final Set<ConfigurationClassMethod> methods = new LinkedHashSet<ConfigurationClassMethod>();
|
||||
private final Set<BeanMethod> beanMethods = new LinkedHashSet<BeanMethod>();
|
||||
|
||||
private String beanName;
|
||||
|
||||
|
|
@ -89,12 +89,12 @@ final class ConfigurationClass {
|
|||
return this.beanName;
|
||||
}
|
||||
|
||||
public void addMethod(ConfigurationClassMethod method) {
|
||||
this.methods.add(method);
|
||||
public void addBeanMethod(BeanMethod method) {
|
||||
this.beanMethods.add(method);
|
||||
}
|
||||
|
||||
public Set<ConfigurationClassMethod> getMethods() {
|
||||
return this.methods;
|
||||
public Set<BeanMethod> getBeanMethods() {
|
||||
return this.beanMethods;
|
||||
}
|
||||
|
||||
public void addImportedResource(String importedResource, Class<?> readerClass) {
|
||||
|
|
@ -110,9 +110,9 @@ final class ConfigurationClass {
|
|||
// @Configuration class may declare two @Bean methods with the same name.
|
||||
final char hashDelim = '#';
|
||||
Map<String, Integer> methodNameCounts = new HashMap<String, Integer>();
|
||||
for (ConfigurationClassMethod method : methods) {
|
||||
String dClassName = method.getMetadata().getDeclaringClassName();
|
||||
String methodName = method.getMetadata().getMethodName();
|
||||
for (BeanMethod beanMethod : beanMethods) {
|
||||
String dClassName = beanMethod.getMetadata().getDeclaringClassName();
|
||||
String methodName = beanMethod.getMetadata().getMethodName();
|
||||
String fqMethodName = dClassName + hashDelim + methodName;
|
||||
Integer currentCount = methodNameCounts.get(fqMethodName);
|
||||
int newCount = currentCount != null ? currentCount + 1 : 1;
|
||||
|
|
@ -134,8 +134,8 @@ final class ConfigurationClass {
|
|||
}
|
||||
}
|
||||
|
||||
for (ConfigurationClassMethod method : this.methods) {
|
||||
method.validate(problemReporter);
|
||||
for (BeanMethod beanMethod : this.beanMethods) {
|
||||
beanMethod.validate(problemReporter);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ public class ConfigurationClassBeanDefinitionReader {
|
|||
AnnotationMetadata metadata = configClass.getMetadata();
|
||||
processFeatureAnnotations(metadata);
|
||||
doLoadBeanDefinitionForConfigurationClassIfNecessary(configClass);
|
||||
for (ConfigurationClassMethod beanMethod : configClass.getMethods()) {
|
||||
for (BeanMethod beanMethod : configClass.getBeanMethods()) {
|
||||
loadBeanDefinitionsForBeanMethod(beanMethod);
|
||||
}
|
||||
loadBeanDefinitionsFromImportedResources(configClass.getImportedResources());
|
||||
|
|
@ -200,10 +200,10 @@ public class ConfigurationClassBeanDefinitionReader {
|
|||
}
|
||||
|
||||
/**
|
||||
* Read a particular {@link ConfigurationClassMethod}, registering bean definitions
|
||||
* Read a particular {@link BeanMethod}, registering bean definitions
|
||||
* with the BeanDefinitionRegistry based on its contents.
|
||||
*/
|
||||
private void loadBeanDefinitionsForBeanMethod(ConfigurationClassMethod beanMethod) {
|
||||
private void loadBeanDefinitionsForBeanMethod(BeanMethod beanMethod) {
|
||||
ConfigurationClass configClass = beanMethod.getConfigurationClass();
|
||||
MethodMetadata metadata = beanMethod.getMetadata();
|
||||
|
||||
|
|
|
|||
|
|
@ -150,8 +150,8 @@ class ConfigurationClassParser {
|
|||
}
|
||||
}
|
||||
Set<MethodMetadata> beanMethods = metadata.getAnnotatedMethods(Bean.class.getName());
|
||||
for (MethodMetadata beanMethod : beanMethods) {
|
||||
configClass.addMethod(new ConfigurationClassMethod(beanMethod, configClass));
|
||||
for (MethodMetadata methodMetadata : beanMethods) {
|
||||
configClass.addBeanMethod(new BeanMethod(methodMetadata, configClass));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue