public class ApplicationConfiguration extends Object
Modifier and Type | Field and Description |
---|---|
static String |
APPLICATION_DEFAULT_SINGLE_INSTANCE_PORT_PROPERTY_NAME
The property name of the optional default single instance port property in the applicationConfig.properties file to indicate a single instance application.
|
static String |
APPLICATION_PROPERTIES_FILE_PATH_ABSOLUTE
The absolute path of the applicationConfig.properties file expected to be packaged within the application JAR.
|
static String |
APPLICATION_PROPERTIES_FILE_PATH_RELATIVE
The relative path of the applicationConfig.properties file expected to be packaged within the application JAR.
|
Constructor and Description |
---|
ApplicationConfiguration()
Creates a new instance of this class and loads the application configuration from the file '/applicationConfig.properties', if available.
|
Modifier and Type | Method and Description |
---|---|
int |
getDefaultSingleInstancePort()
Gets the configured default single instance port.
|
double |
getDoubleProperty(String key,
double defaultValue,
String errorMessageFormat)
Gets the double value associated with the specified key.
|
Integer |
getIntegerProperty(String key,
Integer defaultValue,
String errorMessageFormat)
Gets the integer value associated with the specified key.
|
double |
getPositiveDoubleProperty(String key,
double defaultValue,
String errorMessageFormat)
Gets the positive double value associated with the specified key.
|
String |
getStringProperty(String key)
Gets the String value associated with the specified key.
|
boolean |
isSingleInstanceApplication()
Flag if this is a single instance application.
|
public static final String APPLICATION_PROPERTIES_FILE_PATH_RELATIVE
public static final String APPLICATION_PROPERTIES_FILE_PATH_ABSOLUTE
public static final String APPLICATION_DEFAULT_SINGLE_INSTANCE_PORT_PROPERTY_NAME
public ApplicationConfiguration()
public double getDoubleProperty(String key, double defaultValue, String errorMessageFormat)
key
- the keydefaultValue
- the default valueerrorMessageFormat
- the error message formatpublic double getPositiveDoubleProperty(String key, double defaultValue, String errorMessageFormat)
key
- the keydefaultValue
- the default value returned if the value could not be loaded or was not positiveerrorMessageFormat
- the error message formatpublic Integer getIntegerProperty(String key, Integer defaultValue, String errorMessageFormat)
key
- the keydefaultValue
- the default valueerrorMessageFormat
- the error message formatpublic String getStringProperty(String key)
key
- the keypublic boolean isSingleInstanceApplication()
public int getDefaultSingleInstancePort()
Copyright © 2012–2019 Drombler. All rights reserved.