java.lang.Object
com.adventure.config.ApplicationContextProvider
- All Implemented Interfaces:
ApplicationContext
This class implements a singleton pattern.
The responsibility of this class is to provide a context object in the whole application.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final org.apache.logging.log4j.Logger
Logger. -
Method Summary
Modifier and TypeMethodDescriptionApplication configuration getter.getGame()
Game getter.static ApplicationContextProvider
Singleton getter.void
Game setter.
-
Field Details
-
logger
protected static final org.apache.logging.log4j.Logger loggerLogger.
-
-
Method Details
-
getInstance
Singleton getter. Returns null if the configuration file is not found.- Returns:
- Singleton instance.
-
getGame
Game getter.- Specified by:
getGame
in interfaceApplicationContext
- Returns:
- Game.
-
getConfig
Application configuration getter.- Specified by:
getConfig
in interfaceApplicationContext
- Returns:
- Current application config.
-
setGame
Game setter.- Specified by:
setGame
in interfaceApplicationContext
- Parameters:
game
- Game.
-