Class CommandLineArguments
- java.lang.Object
-
- ch.sahits.game.openpatrician.display.CommandLineArguments
-
public class CommandLineArguments extends java.lang.Object
Helper class to encapsulate the funcionality concerning command line arguments- Author:
- Andi Hotz, (c) Sahits GmbH, 2013 Created on Jan 16, 2013
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CLIENT_OPTION
private static java.lang.String
FULLSCREEN_MODE
static java.lang.String
GAME_LOCALE
private GamePropertyUtility
gameProperties
static java.lang.String
HELP_OPTION
private org.apache.commons.cli.CommandLineParser
parser
static java.lang.String
SERVER_OPTION
static java.lang.String
VERSION_OPTION
private static java.lang.String
WINDOWED_MODE
-
Constructor Summary
Constructors Constructor Description CommandLineArguments()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
checkMinimalHeight(int height)
org.apache.commons.cli.Options
createCommandLineOptions()
boolean
isClient(org.apache.commons.cli.CommandLine cmdLine)
Check weather the application is started as client.boolean
isServer(org.apache.commons.cli.CommandLine cmdLine)
Check weather the application is started as server.boolean
isStandalone(org.apache.commons.cli.CommandLine cmdLine)
Check wether the commandline arguments for standalone are set.org.apache.commons.cli.CommandLine
parseCommandLine(org.apache.commons.cli.Options options, java.lang.String[] args)
void
persistAsPropertyFile(org.apache.commons.cli.CommandLine cmdLine)
Set the spring profiles and write some properties, which will be used by Spring.void
printHelp(org.apache.commons.cli.Options options)
-
-
-
Field Detail
-
VERSION_OPTION
public static final java.lang.String VERSION_OPTION
- See Also:
- Constant Field Values
-
HELP_OPTION
public static final java.lang.String HELP_OPTION
- See Also:
- Constant Field Values
-
GAME_LOCALE
public static final java.lang.String GAME_LOCALE
- See Also:
- Constant Field Values
-
WINDOWED_MODE
private static final java.lang.String WINDOWED_MODE
- See Also:
- Constant Field Values
-
FULLSCREEN_MODE
private static final java.lang.String FULLSCREEN_MODE
- See Also:
- Constant Field Values
-
CLIENT_OPTION
public static final java.lang.String CLIENT_OPTION
- See Also:
- Constant Field Values
-
SERVER_OPTION
public static final java.lang.String SERVER_OPTION
- See Also:
- Constant Field Values
-
parser
private org.apache.commons.cli.CommandLineParser parser
-
gameProperties
private GamePropertyUtility gameProperties
-
-
Method Detail
-
createCommandLineOptions
public org.apache.commons.cli.Options createCommandLineOptions()
-
parseCommandLine
public org.apache.commons.cli.CommandLine parseCommandLine(org.apache.commons.cli.Options options, java.lang.String[] args)
-
printHelp
public void printHelp(org.apache.commons.cli.Options options)
-
isStandalone
public boolean isStandalone(org.apache.commons.cli.CommandLine cmdLine)
Check wether the commandline arguments for standalone are set.- Parameters:
cmdLine
- command line object- Returns:
- true if both client and server arguments are specified or neither.
-
isServer
public boolean isServer(org.apache.commons.cli.CommandLine cmdLine)
Check weather the application is started as server.- Parameters:
cmdLine
- command line object- Returns:
- true if only the server flag is set
-
isClient
public boolean isClient(org.apache.commons.cli.CommandLine cmdLine)
Check weather the application is started as client.- Parameters:
cmdLine
- command line object- Returns:
- true if only the client flag is set
-
persistAsPropertyFile
public void persistAsPropertyFile(org.apache.commons.cli.CommandLine cmdLine)
Set the spring profiles and write some properties, which will be used by Spring.- Parameters:
cmdLine
- command line object
-
checkMinimalHeight
private void checkMinimalHeight(int height)
-
-