Class PropertyHandler


  • public class PropertyHandler
    extends Object
    • Constructor Detail

      • PropertyHandler

        public PropertyHandler()
        Instantiates a new property handler.
      • PropertyHandler

        public PropertyHandler​(String propertyfile,
                               String validationFile)
      • PropertyHandler

        public PropertyHandler​(String propertyfile,
                               String validationFile,
                               String ignored)
      • PropertyHandler

        public PropertyHandler​(String configDir,
                               InputStream... inputStreams)
      • PropertyHandler

        public PropertyHandler​(Properties properties)
        Instantiates a new property handler.
        Parameters:
        properties - the properties
    • Method Detail

      • parentPath

        public static String parentPath​(String propertyfile)
      • path

        public static Path path​(String propertyfile)
      • getInstance

        public static PropertyHandler getInstance()
        Gets the single instance of PropertyHandler.
        Returns:
        single instance of PropertyHandler
      • withParentPathGenerator

        public static void withParentPathGenerator​(java8.util.function.Function<Path,​String> generator,
                                                   Runnable task)
      • getProperty

        public String getProperty​(String string)
        Gets the property.
        Parameters:
        string - the string
        Returns:
        the property
      • getIntegerProperty

        public Integer getIntegerProperty​(String string)
        Gets the integer property.
        Parameters:
        string - the string
        Returns:
        the integer property
      • getURLProperty

        public URL getURLProperty​(String string)
        Gets the uRL property.
        Parameters:
        string - the string
        Returns:
        the uRL property
      • getIntegerProperty

        public Integer getIntegerProperty​(String string,
                                          String defaultValue)
        Gets the integer property.
        Parameters:
        string - the string
        defaultValue - the default value
        Returns:
        the integer property
      • getProperty

        public String getProperty​(String string,
                                  String defaultValue)
        Gets the property.
        Parameters:
        string - the string
        defaultValue - the default value
        Returns:
        the property
      • hasProperty

        public boolean hasProperty​(String key)
        Checks for property.
        Parameters:
        key - the key
        Returns:
        true, if successful
      • getProperties

        public Properties getProperties()
        Gets the properties.
        Returns:
        the properties
      • getPropertiesCopy

        public Properties getPropertiesCopy()
        Returns a copy of the current properties.
        Returns:
        the properties copy
      • getMatchingProperties

        public List<String> getMatchingProperties​(String rootKey)
        Gets the properties that match a root key.
        Parameters:
        rootKey - the root key
        Returns:
        the properties
      • setProperty

        public void setProperty​(String key,
                                String value)
        Sets the property.
        Parameters:
        key - the key
        value - the value
      • isLog4jInitialized

        public boolean isLog4jInitialized()
        Checks if is log 4 j initialized.
        Returns:
        true, if is log 4 j initialized
      • setLog4jInitialized

        public void setLog4jInitialized​(boolean log4jInitialized)
        Sets the log 4 j initialized.
        Parameters:
        log4jInitialized - the new log 4 j initialized
      • setProperties

        public void setProperties​(Properties properties)
        Sets the properties.
        Parameters:
        properties - the new properties
      • getBooleanProperty

        public boolean getBooleanProperty​(String value,
                                          String defaultValue)
        Gets the boolean property.
        Parameters:
        value - the value
        defaultValue - the default value
        Returns:
        the boolean property