Class ApplicationContextProvider

java.lang.Object
com.adventure.config.ApplicationContextProvider
All Implemented Interfaces:
ApplicationContext

public class ApplicationContextProvider extends Object implements ApplicationContext
This class implements a singleton pattern. The responsibility of this class is to provide a context object in the whole application.
  • Field Details

    • logger

      protected static final org.apache.logging.log4j.Logger logger
      Logger.
  • Method Details

    • getInstance

      public static ApplicationContextProvider getInstance()
      Singleton getter. Returns null if the configuration file is not found.
      Returns:
      Singleton instance.
    • getGame

      public Game getGame()
      Game getter.
      Specified by:
      getGame in interface ApplicationContext
      Returns:
      Game.
    • getConfig

      public Config getConfig()
      Application configuration getter.
      Specified by:
      getConfig in interface ApplicationContext
      Returns:
      Current application config.
    • setGame

      public void setGame(Game game)
      Game setter.
      Specified by:
      setGame in interface ApplicationContext
      Parameters:
      game - Game.