Class AppPropertiesService
java.lang.Object
fr.paris.lutece.portal.service.util.AppPropertiesService
this class provides management services for properties files
-
Method Summary
Modifier and TypeMethodDescriptionReturns 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 PropertiesGets propertiesGets all properties as a Mapstatic StringgetProperty(String strProperty) Returns the value of a variable defined in the .properties file of the application as a Stringstatic StringgetProperty(String strProperty, String strDefault) Returns the value of a variable defined in the .properties file of the application as a Stringstatic booleangetPropertyBoolean(String strProperty, boolean bDefault) Returns the value of a variable defined in the .properties file of the application as a booleanstatic intgetPropertyInt(String strProperty, int nDefault) Returns the value of a variable defined in the .properties file of the application as an intstatic longgetPropertyLong(String strProperty, long lDefault) Returns the value of a variable defined in the .properties file of the application as an longstatic voidDeprecated.static voidDeprecated.
-
Method Details
-
getProperty
Returns the value of a variable defined in the .properties file of the application as a String- Parameters:
strProperty- The variable name- Returns:
- The variable value read in the properties file
-
getProperty
Returns the value of a variable defined in the .properties file of the application as a String- Parameters:
strProperty- The variable namestrDefault- The default value which is returned if no value is found for the variable in the .properties file.- Returns:
- The variable value read in the properties file
-
getPropertyInt
Returns the value of a variable defined in the .properties file of the application as an int- Parameters:
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.- Returns:
- The variable value read in the properties file
-
getPropertyLong
Returns the value of a variable defined in the .properties file of the application as an long- Parameters:
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.- Returns:
- The variable value read in the properties file
-
getPropertyBoolean
Returns the value of a variable defined in the .properties file of the application as a boolean- Parameters:
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.- Returns:
- The variable value read in the properties file
-
getOptionalValue
Return the resolved property value with the specified type for the specified property name from the underlying configuration sources.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.
- Type Parameters:
T- The property type- Parameters:
propertyName- The configuration property namepropertyType- The type into which the resolved property value should be converted- Returns:
- The resolved property value as an
Optionalwrapping the requested type - Throws:
IllegalArgumentException- if the property cannot be converted to the specified type
-
reloadAll
Deprecated.Reloads all the properties files -
reload
Deprecated.Reloads a given properties file- Parameters:
strFilename- The file name
-
getProperties
Gets properties- Returns:
- All properties
- Since:
- version 3.0
-
getPropertiesAsMap
Gets all properties as a Map- Returns:
- a Map of all properties
- Since:
- version 5.0
-
getKeys
Returns a list of keys that match a given prefix.- Parameters:
strPrefix- the str prefix- Returns:
- A list of keys that match the prefix
- Since:
- version 3.0
-