java.lang.Object
be.yildizgames.common.application.Application

public class Application extends Object
Main application class. This class is responsible for: Configuring the application (logging, etc) Displaying a banner on startup Managing application updates
Author:
Grégory Van den Borre
  • Method Details

    • prepare

      public static Application prepare(String applicationName)
      Prepare to start the application.
      Parameters:
      applicationName - Application name.
      Returns:
      The application.
    • withConfiguration

      public final Application withConfiguration(String[] args, Properties defaultConfig, be.yildizgames.common.configuration.ConfigurationNotFoundAdditionalBehavior behavior)
      Add configuration to the application.
      Parameters:
      args - Arguments to override the configuration.
      defaultConfig - Default configuration to use for values not provided.
      behavior - Behavior to run if not configuration is provided.
      Returns:
      The application.
    • withBanner

      public final Application withBanner(Banner banner)
      To set a custom banner, the banner will be displayed in the console interface when starting the application.
      Parameters:
      banner - Custom banner to set.
      Returns:
      The application.
    • withSplashScreen

      public final Application withSplashScreen(SplashScreenProvider splashScreen)
      Set a splash screen to display when starting the application.
      Parameters:
      splashScreen - Splash screen to display.
      Returns:
      The application.
    • addBannerLine

      public final Application addBannerLine(BannerLine line)
      Add a line to the banner.
      Parameters:
      line - Line to add.
      Returns:
      The application.
    • withConfiguration

      public final Application withConfiguration(String[] args, Properties defaultConfig)
      Add configuration to the application.
      Parameters:
      args - Arguments to override the configuration.
      defaultConfig - Default configuration to use for values not provided.
      Returns:
      The application.
    • withUpdate

      public final Application withUpdate(String url)
      Provide the update mechanism.
      Parameters:
      url - Url to call to get the update manifest.
      Returns:
      The application.
    • withUpdate

      public final Application withUpdate(String url, int timeout)
      Provide the update mechanism.
      Parameters:
      url - Url to call to get the update manifest.
      timeout - Timeout for the update connection.
      Returns:
      The application.
    • start

      public final Application start()
      Initialize and start the application.
      Returns:
      The application.
    • start

      public final Application start(Starter starter)
      Initialize and start the application by using a starter. Provide support to log all uncaught exceptions.
      Parameters:
      starter - Starting application.
      Returns:
      The application.
    • applicationStarted

      public final void applicationStarted()
      To call once the application is started, this will close the splashscreen.
    • getConfiguration

      public final Properties getConfiguration()
      Get the application configuration.
      Returns:
      The configuration properties.