Created
February 27, 2014 12:08
-
-
Save Vox1oot/9248883 to your computer and use it in GitHub Desktop.
package com.javarush.test.level17.lesson10.home07
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.javarush.test.level17.lesson10.home07; | |
import java.util.HashMap; | |
import java.util.Map; | |
/* ApplicationContext | |
ApplicationContext будет доступен множеству нитей. | |
Сделать так, чтобы данные не терялись: подумай, какое ключевое слово необходимо поставить и где. | |
*/ | |
public abstract class ApplicationContext<GenericsBean extends Bean> { | |
private Map<String, GenericsBean> container = new HashMap<String, GenericsBean>(); | |
//Map<Name, some class implemented Bean interface> | |
protected ApplicationContext() { | |
parseAllClassesAndInterfaces(); | |
} | |
public synchronized GenericsBean getByName(String name) { | |
return container.get(name); | |
} | |
public synchronized GenericsBean removeByName(String name) { | |
return container.remove(name); | |
} | |
protected abstract void parseAllClassesAndInterfaces(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.javarush.test.level17.lesson10.home07; | |
public interface Bean { //это интерфейс-маркер | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment