Class PropertiesService

java.lang.Object
fr.paris.lutece.util.PropertiesService

public class PropertiesService extends Object
This class provides utility methods to read values of the properties stored in the .properties file of the application.
  • Constructor Details

    • PropertiesService

      public PropertiesService()
      Constructor should define the base root path for properties files
      Parameters:
      strRootPath - The root path
  • Method Details

    • addPropertiesFile

      public void addPropertiesFile(String strRelativePath, String strFilename)
      Add properties from a properties file
      Parameters:
      strRelativePath - Relative path from the root path
      strFilename - The filename of the properties file (ie: config.properties)
    • addPropertiesDirectory

      public void addPropertiesDirectory(String... strRelativePaths)
      Add properties from all files found in a given directory
      Parameters:
      strRelativePath - Relative path
    • reload

      public void reload(String strFilename)
      Reload a properties file .
      Parameters:
      strFilename - The filename of the properties file
    • reloadAll

      public void reloadAll()
      Reload all properties files
    • getProperty

      public String getProperty(String strProperty)
      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

      public String getProperty(String strProperty, String strDefault)
      Returns the value of a variable defined in the .properties file of the application as a String
      Parameters:
      strProperty - The variable name
      strDefault - 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
    • getProperties

      public Properties getProperties()
      Gets properties
      Returns:
      All properties