public class JPService extends Object
| Constructor and Description |
|---|
JPService() |
| Modifier and Type | Method and Description |
|---|---|
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(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() |
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(String[] args)
args - public static void printError(Throwable cause)
cause - protected static void printError(Throwable cause, String prefix)
cause - prefix - public static void parse(String[] args) throws JPServiceException
args - JPServiceExceptionpublic 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 String newLineFormatter(String text, String newLineOperator, int maxChars)
text - newLineOperator - maxChars - public static void reset()
public static boolean testMode()
Copyright © 2014–2016 openbase.org. All rights reserved.