Class Application
java.lang.Object
be.yildizgames.common.application.Application
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 Summary
Modifier and TypeMethodDescriptionfinal ApplicationaddBannerLine(BannerLine line) Add a line to the banner.final voidTo call once the application is started, this will close the splashscreen.final PropertiesGet the application configuration.static ApplicationPrepare to start the application.final Applicationstart()Initialize and start the application.final ApplicationInitialize and start the application by using a starter.final ApplicationwithBanner(Banner banner) To set a custom banner, the banner will be displayed in the console interface when starting the application.final ApplicationwithConfiguration(String[] args, Properties defaultConfig) Add configuration to the application.final ApplicationwithConfiguration(String[] args, Properties defaultConfig, be.yildizgames.common.configuration.ConfigurationNotFoundAdditionalBehavior behavior) Add configuration to the application.final ApplicationwithSplashScreen(SplashScreenProvider splashScreen) Set a splash screen to display when starting the application.final ApplicationwithUpdate(String url) Provide the update mechanism.final ApplicationwithUpdate(String url, int timeout) Provide the update mechanism.
-
Method Details
-
prepare
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
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
Set a splash screen to display when starting the application.- Parameters:
splashScreen- Splash screen to display.- Returns:
- The application.
-
addBannerLine
Add a line to the banner.- Parameters:
line- Line to add.- Returns:
- The application.
-
withConfiguration
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
Provide the update mechanism.- Parameters:
url- Url to call to get the update manifest.- Returns:
- The application.
-
withUpdate
Provide the update mechanism.- Parameters:
url- Url to call to get the update manifest.timeout- Timeout for the update connection.- Returns:
- The application.
-
start
Initialize and start the application.- Returns:
- The application.
-
start
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
Get the application configuration.- Returns:
- The configuration properties.
-