public class JPService extends Object
| Constructor and Description |
|---|
JPService() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
debugMode() |
static boolean |
forceMode() |
static org.slf4j.Logger |
getApplicationLogger()
Returns the logger instance of the main class.
|
static org.slf4j.Logger |
getApplicationLogger(org.slf4j.Logger defaultLogger)
Returns the logger instance of the main class.
|
static String |
getApplicationName()
Returns the configurated application name.
|
static <C extends AbstractJavaProperty> |
getProperty(Class<C> propertyClass)
Returns the current value of the given property line class.
|
static String |
newLineFormatter(String text,
String newLineOperator,
int maxChars) |
static <V,C extends AbstractJavaProperty<V>> |
overwriteDefaultValue(Class<C> propertyClass,
V defaultValue)
Overwrites the default value of the given property without displaying the property in the help overview, For overwriting a regular property default value, use the property registration method
instead.
|
static void |
parse(List<String> args)
Analyze the input arguments and setup all registered Properties.
|
static void |
parse(String[] args)
Analyze the input arguments and setup all registered Properties.
|
static void |
parseAndExitOnError(List<String> args)
Analyze the input arguments and setup all registered Properties.
|
static void |
parseAndExitOnError(String[] args)
Analyze the input arguments and setup all registered Properties.
|
static void |
printError(String message,
Throwable cause) |
static void |
printError(Throwable cause) |
protected static void |
printError(Throwable cause,
String prefix) |
static void |
printHelp()
Method prints the help screen.
|
static void |
registerProperty(Class<? extends AbstractJavaProperty> propertyClass)
Register new property.
|
static <V,C extends AbstractJavaProperty<V>> |
registerProperty(Class<C> propertyClass,
V defaultValue)
Register the given property and overwrite the default value of the given one.
|
static void |
reset() |
static void |
setApplicationName(Class mainclass)
Set the application name by the main class name.
|
static void |
setApplicationName(String name)
Set the application name.
|
static void |
setupJUnitTestMode()
Setup JPService for JUnitTests By using the JPService during JUnit Tests it's recommended to call this method after property registration instead using the parsing methods because command line
property handling makes no sense in the context of unit tests..
|
static boolean |
testMode() |
static boolean |
verboseMode() |
public static void setApplicationName(String name)
name - the application namepublic static void setApplicationName(Class mainclass)
mainclass - the application mainclass which is used to generate the application name.public static String getApplicationName()
public static <V,C extends AbstractJavaProperty<V>> void registerProperty(Class<C> propertyClass, V defaultValue)
V - C - propertyClass - defaultValue - public static <V,C extends AbstractJavaProperty<V>> void overwriteDefaultValue(Class<C> propertyClass, V defaultValue)
V - C - propertyClass - defaultValue - public static void registerProperty(Class<? extends AbstractJavaProperty> propertyClass)
propertyClass - public static void parseAndExitOnError(List<String> args)
args - Arguments as a string list e.g. given by a java fx application getParameters().getRaw() in the start method.public static void parseAndExitOnError(String[] args)
args - Arguments given by the main method.public static void parse(List<String> args) throws JPServiceException
args - Arguments as a string list e.g. given by a java fx application getParameters().getRaw() in the start method.JPServiceExceptionpublic static void parse(String[] args) throws JPServiceException
args - Arguments given by the main method.JPServiceExceptionpublic static void printError(Throwable cause)
cause - protected static void printError(Throwable cause, String prefix)
cause - prefix - public static void setupJUnitTestMode()
throws JPServiceException
JPServiceExceptionpublic static <C extends AbstractJavaProperty> C getProperty(Class<C> propertyClass) throws JPNotAvailableException
C - propertyClass - property class which defines the property.JPNotAvailableException - thrown if the given property could not be .public static void printHelp()
throws JPServiceException
JPServiceExceptionpublic static org.slf4j.Logger getApplicationLogger(org.slf4j.Logger defaultLogger)
setApplicationName() the defaultLogger is used.public static org.slf4j.Logger getApplicationLogger()
setApplicationName() the jpservice default logger instance is used.public static String newLineFormatter(String text, String newLineOperator, int maxChars)
text - newLineOperator - maxChars - public static void reset()
public static boolean testMode()
public static boolean verboseMode()
public static boolean forceMode()
public static boolean debugMode()
Copyright © 2014–2018 openbase.org. All rights reserved.