@@ -315,12 +315,13 @@ private void processImport(ConfigurationClass configClass, String[] classesToImp
315
315
AnnotationMetadata importingClassMetadata = configClass .getMetadata ();
316
316
for (String candidate : classesToImport ) {
317
317
MetadataReader reader = this .metadataReaderFactory .getMetadataReader (candidate );
318
- if (new AssignableTypeFilter (ImportSelector .class ).match (reader , metadataReaderFactory )) {
318
+ if (new AssignableTypeFilter (ImportSelector .class ).match (reader , this . metadataReaderFactory )) {
319
319
// the candidate class is an ImportSelector -> delegate to it to determine imports
320
320
try {
321
321
ImportSelector selector = BeanUtils .instantiateClass (Class .forName (candidate ), ImportSelector .class );
322
322
processImport (configClass , selector .selectImports (importingClassMetadata ), false );
323
- } catch (ClassNotFoundException ex ) {
323
+ }
324
+ catch (ClassNotFoundException ex ) {
324
325
throw new IllegalStateException (ex );
325
326
}
326
327
}
@@ -329,7 +330,8 @@ else if (new AssignableTypeFilter(ImportBeanDefinitionRegistrar.class).match(rea
329
330
try {
330
331
ImportBeanDefinitionRegistrar registrar = BeanUtils .instantiateClass (Class .forName (candidate ), ImportBeanDefinitionRegistrar .class );
331
332
registrar .registerBeanDefinitions (importingClassMetadata , registry );
332
- } catch (ClassNotFoundException ex ) {
333
+ }
334
+ catch (ClassNotFoundException ex ) {
333
335
throw new IllegalStateException (ex );
334
336
}
335
337
}
@@ -367,21 +369,22 @@ public ImportRegistry getImportRegistry() {
367
369
368
370
369
371
interface ImportRegistry {
372
+
370
373
String getImportingClassFor (String importedClass );
371
374
}
372
375
373
376
374
377
@ SuppressWarnings ("serial" )
375
378
private static class ImportStack extends Stack <ConfigurationClass > implements ImportRegistry {
376
379
377
- private Map <String , String > imports = new HashMap <String , String >();
380
+ private final Map <String , String > imports = new HashMap <String , String >();
378
381
379
- public String getImportingClassFor ( String importedClass ) {
380
- return imports .get (importedClass );
382
+ public void registerImport ( String importingClass , String importedClass ) {
383
+ this . imports .put (importedClass , importingClass );
381
384
}
382
385
383
- public void registerImport ( String importingClass , String importedClass ) {
384
- imports .put (importedClass , importingClass );
386
+ public String getImportingClassFor ( String importedClass ) {
387
+ return this . imports .get (importedClass );
385
388
}
386
389
387
390
/**
0 commit comments