@Component @Lazy @DependentInitialisation(value=StartNewGameBean.class) public class CityFactory extends Object
| Modifier and Type | Field and Description |
|---|---|
private org.springframework.context.ApplicationContext |
context |
private static ConcurrentHashMap<String,ICity> |
createdCityCache
Cache storing the already created cities to avoid duplicate creation
|
private static org.apache.logging.log4j.Logger |
logger |
private ch.sahits.game.openpatrician.data.map.Map |
map |
private MapSegmentImageFactory |
mapSegmentImageFactory |
private org.springframework.oxm.Unmarshaller |
unmarshaller |
| Constructor and Description |
|---|
CityFactory() |
| Modifier and Type | Method and Description |
|---|---|
private ICity |
createCity(ch.sahits.game.openpatrician.data.map.City city) |
ICity |
createCityByName(String cityName)
Create a standard city based on its name
|
Collection<ICity> |
getCities()
Retrieve all cities from the internal cache.
|
private List<ch.sahits.game.openpatrician.data.map.City> |
getCities(String mapName) |
private Source |
getSourceFromFile(String fileName) |
void |
initializeCityCache(String mapName)
Initialize all cities defined in
mapName |
private static final org.apache.logging.log4j.Logger logger
@Autowired @Qualifier(value="jaxb2MapMarshaller") private org.springframework.oxm.Unmarshaller unmarshaller
@Autowired private org.springframework.context.ApplicationContext context
@Autowired private MapSegmentImageFactory mapSegmentImageFactory
private static ConcurrentHashMap<String,ICity> createdCityCache
private ch.sahits.game.openpatrician.data.map.Map map
private List<ch.sahits.game.openpatrician.data.map.City> getCities(String mapName)
public void initializeCityCache(String mapName) throws IOException
mapNamemapName - name of the XML fileIOException - invalid XML fileprivate ICity createCity(ch.sahits.game.openpatrician.data.map.City city)
public Collection<ICity> getCities()
public ICity createCityByName(String cityName) throws IOException
cityName - IOException - Error reading the city propertiesCopyright © 2011-2015 Sahits GmbH. All Rights Reserved.