1
1
/*
2
- * Copyright 2002-2019 the original author or authors.
2
+ * Copyright 2002-2021 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
36
36
37
37
/**
38
38
* Represents a user-defined {@link Configuration @Configuration} class.
39
- * Includes a set of {@link Bean} methods, including all such methods
39
+ * <p> Includes a set of {@link Bean} methods, including all such methods
40
40
* defined in the ancestry of the class, in a 'flattened-out' manner.
41
41
*
42
42
* @author Chris Beams
@@ -74,7 +74,7 @@ final class ConfigurationClass {
74
74
* @param beanName must not be {@code null}
75
75
* @see ConfigurationClass#ConfigurationClass(Class, ConfigurationClass)
76
76
*/
77
- public ConfigurationClass (MetadataReader metadataReader , String beanName ) {
77
+ ConfigurationClass (MetadataReader metadataReader , String beanName ) {
78
78
Assert .notNull (beanName , "Bean name must not be null" );
79
79
this .metadata = metadataReader .getAnnotationMetadata ();
80
80
this .resource = metadataReader .getResource ();
@@ -89,7 +89,7 @@ public ConfigurationClass(MetadataReader metadataReader, String beanName) {
89
89
* @param importedBy the configuration class importing this one or {@code null}
90
90
* @since 3.1.1
91
91
*/
92
- public ConfigurationClass (MetadataReader metadataReader , @ Nullable ConfigurationClass importedBy ) {
92
+ ConfigurationClass (MetadataReader metadataReader , @ Nullable ConfigurationClass importedBy ) {
93
93
this .metadata = metadataReader .getAnnotationMetadata ();
94
94
this .resource = metadataReader .getResource ();
95
95
this .importedBy .add (importedBy );
@@ -101,7 +101,7 @@ public ConfigurationClass(MetadataReader metadataReader, @Nullable Configuration
101
101
* @param beanName name of the {@code @Configuration} class bean
102
102
* @see ConfigurationClass#ConfigurationClass(Class, ConfigurationClass)
103
103
*/
104
- public ConfigurationClass (Class <?> clazz , String beanName ) {
104
+ ConfigurationClass (Class <?> clazz , String beanName ) {
105
105
Assert .notNull (beanName , "Bean name must not be null" );
106
106
this .metadata = AnnotationMetadata .introspect (clazz );
107
107
this .resource = new DescriptiveResource (clazz .getName ());
@@ -116,7 +116,7 @@ public ConfigurationClass(Class<?> clazz, String beanName) {
116
116
* @param importedBy the configuration class importing this one (or {@code null})
117
117
* @since 3.1.1
118
118
*/
119
- public ConfigurationClass (Class <?> clazz , @ Nullable ConfigurationClass importedBy ) {
119
+ ConfigurationClass (Class <?> clazz , @ Nullable ConfigurationClass importedBy ) {
120
120
this .metadata = AnnotationMetadata .introspect (clazz );
121
121
this .resource = new DescriptiveResource (clazz .getName ());
122
122
this .importedBy .add (importedBy );
@@ -128,27 +128,27 @@ public ConfigurationClass(Class<?> clazz, @Nullable ConfigurationClass importedB
128
128
* @param beanName name of the {@code @Configuration} class bean
129
129
* @see ConfigurationClass#ConfigurationClass(Class, ConfigurationClass)
130
130
*/
131
- public ConfigurationClass (AnnotationMetadata metadata , String beanName ) {
131
+ ConfigurationClass (AnnotationMetadata metadata , String beanName ) {
132
132
Assert .notNull (beanName , "Bean name must not be null" );
133
133
this .metadata = metadata ;
134
134
this .resource = new DescriptiveResource (metadata .getClassName ());
135
135
this .beanName = beanName ;
136
136
}
137
137
138
138
139
- public AnnotationMetadata getMetadata () {
139
+ AnnotationMetadata getMetadata () {
140
140
return this .metadata ;
141
141
}
142
142
143
- public Resource getResource () {
143
+ Resource getResource () {
144
144
return this .resource ;
145
145
}
146
146
147
- public String getSimpleName () {
147
+ String getSimpleName () {
148
148
return ClassUtils .getShortName (getMetadata ().getClassName ());
149
149
}
150
150
151
- public void setBeanName (String beanName ) {
151
+ void setBeanName (String beanName ) {
152
152
this .beanName = beanName ;
153
153
}
154
154
@@ -171,7 +171,7 @@ public boolean isImported() {
171
171
* Merge the imported-by declarations from the given configuration class into this one.
172
172
* @since 4.0.5
173
173
*/
174
- public void mergeImportedBy (ConfigurationClass otherConfigClass ) {
174
+ void mergeImportedBy (ConfigurationClass otherConfigClass ) {
175
175
this .importedBy .addAll (otherConfigClass .importedBy );
176
176
}
177
177
@@ -181,35 +181,35 @@ public void mergeImportedBy(ConfigurationClass otherConfigClass) {
181
181
* @since 4.0.5
182
182
* @see #isImported()
183
183
*/
184
- public Set <ConfigurationClass > getImportedBy () {
184
+ Set <ConfigurationClass > getImportedBy () {
185
185
return this .importedBy ;
186
186
}
187
187
188
- public void addBeanMethod (BeanMethod method ) {
188
+ void addBeanMethod (BeanMethod method ) {
189
189
this .beanMethods .add (method );
190
190
}
191
191
192
- public Set <BeanMethod > getBeanMethods () {
192
+ Set <BeanMethod > getBeanMethods () {
193
193
return this .beanMethods ;
194
194
}
195
195
196
- public void addImportedResource (String importedResource , Class <? extends BeanDefinitionReader > readerClass ) {
196
+ void addImportedResource (String importedResource , Class <? extends BeanDefinitionReader > readerClass ) {
197
197
this .importedResources .put (importedResource , readerClass );
198
198
}
199
199
200
- public void addImportBeanDefinitionRegistrar (ImportBeanDefinitionRegistrar registrar , AnnotationMetadata importingClassMetadata ) {
200
+ void addImportBeanDefinitionRegistrar (ImportBeanDefinitionRegistrar registrar , AnnotationMetadata importingClassMetadata ) {
201
201
this .importBeanDefinitionRegistrars .put (registrar , importingClassMetadata );
202
202
}
203
203
204
- public Map <ImportBeanDefinitionRegistrar , AnnotationMetadata > getImportBeanDefinitionRegistrars () {
204
+ Map <ImportBeanDefinitionRegistrar , AnnotationMetadata > getImportBeanDefinitionRegistrars () {
205
205
return this .importBeanDefinitionRegistrars ;
206
206
}
207
207
208
- public Map <String , Class <? extends BeanDefinitionReader >> getImportedResources () {
208
+ Map <String , Class <? extends BeanDefinitionReader >> getImportedResources () {
209
209
return this .importedResources ;
210
210
}
211
211
212
- public void validate (ProblemReporter problemReporter ) {
212
+ void validate (ProblemReporter problemReporter ) {
213
213
// A configuration class may not be final (CGLIB limitation) unless it declares proxyBeanMethods=false
214
214
Map <String , Object > attributes = this .metadata .getAnnotationAttributes (Configuration .class .getName ());
215
215
if (attributes != null && (Boolean ) attributes .get ("proxyBeanMethods" )) {
@@ -244,7 +244,7 @@ public String toString() {
244
244
*/
245
245
private class FinalConfigurationProblem extends Problem {
246
246
247
- public FinalConfigurationProblem () {
247
+ FinalConfigurationProblem () {
248
248
super (String .format ("@Configuration class '%s' may not be final. Remove the final modifier to continue." ,
249
249
getSimpleName ()), new Location (getResource (), getMetadata ()));
250
250
}
0 commit comments