public final class AppPropertiesService extends Object
| Modifier and Type | Method and Description |
|---|---|
static List<String> |
getKeys(String strPrefix)
Returns a list of keys that match a given prefix.
|
<T> Optional<T> |
getOptionalValue(String name,
Class<T> aClass)
Return the resolved property value with the specified type for the specified property name from the underlying
configuration sources.
|
static Properties |
getProperties()
Gets properties
|
static Map<String,String> |
getPropertiesAsMap()
Gets all properties as a Map
|
static String |
getProperty(String strProperty)
Returns the value of a variable defined in the .properties file of the application as a String
|
static String |
getProperty(String strProperty,
String strDefault)
Returns the value of a variable defined in the .properties file of the application as a String
|
static boolean |
getPropertyBoolean(String strProperty,
boolean bDefault)
Returns the value of a variable defined in the .properties file of the application as a boolean
|
static int |
getPropertyInt(String strProperty,
int nDefault)
Returns the value of a variable defined in the .properties file of the application as an int
|
static long |
getPropertyLong(String strProperty,
long lDefault)
Returns the value of a variable defined in the .properties file of the application as an long
|
static void |
init(String strConfPath)
Initializes the service
|
static void |
reload(String strFilename)
Deprecated.
|
static void |
reloadAll()
Deprecated.
|
public static void init(String strConfPath)
strConfPath - The configuration pathpublic static String getProperty(String strProperty)
strProperty - The variable namepublic static String getProperty(String strProperty, String strDefault)
strProperty - The variable namestrDefault - The default value which is returned if no value is found for the variable in the .properties file.public static int getPropertyInt(String strProperty, int nDefault)
strProperty - The variable namenDefault - The default value which is returned if no value is found for the variable in the le downloadFile .properties. .properties file.public static long getPropertyLong(String strProperty, long lDefault)
strProperty - The variable namelDefault - The default value which is returned if no value is found for the variable in the le downloadFile .properties. .properties file.public static boolean getPropertyBoolean(String strProperty, boolean bDefault)
strProperty - The variable namebDefault - The default value which is returned if no value is found for the variable in the le downloadFile .properties. .properties file.public <T> Optional<T> getOptionalValue(String name, Class<T> aClass)
The configuration value is not guaranteed to be cached by the implementation, and may be expensive to compute; therefore, if the returned value is intended to be frequently used, callers should consider storing rather than recomputing it.
If this method is used very often then consider to locally store the configured value.
T - The property typepropertyName - The configuration property namepropertyType - The type into which the resolved property value should be convertedOptional wrapping the requested typeIllegalArgumentException - if the property cannot be converted to the specified type@Deprecated public static void reloadAll()
@Deprecated public static void reload(String strFilename)
strFilename - The file namepublic static Properties getProperties()
public static Map<String,String> getPropertiesAsMap()
Copyright © 2023 City of Paris. All rights reserved.