Class ConfigUtils

  • All Implemented Interfaces:

    
    public class ConfigUtils
    
                        
    Author:

    George Politis

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
      ConfigUtils()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static File getAbsoluteFile(String path, ConfigurationService cfg) Gets an absolute path in the form of File from an absolute or relative path specified in the form of a String.
      static boolean getBoolean(ConfigurationService cfg, String property, boolean defaultValue) Gets the value as a boolean of a property from either a specific ConfigurationService or System.
      static int getInt(ConfigurationService cfg, String property, int defaultValue) Gets the value as an int of a property from either a specific ConfigurationService or System.
      static long getLong(ConfigurationService cfg, String property, long defaultValue) Gets the value as an long of a property from either a specific ConfigurationService or System.
      static String getString(ConfigurationService cfg, String property, String defaultValue) Gets the value as a String of a property from either a specific ConfigurationService or System.
      static String getString(ConfigurationService cfg, String property, String propertyAlternative, String defaultValue) Gets the value as a String of a property from either a specific ConfigurationService or System.
      static String getSystemPropertiesDebugString() Goes over all system properties and builds a string of their names and values for debug purposes.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConfigUtils

        ConfigUtils()
    • Method Detail

      • getAbsoluteFile

         static File getAbsoluteFile(String path, ConfigurationService cfg)

        Gets an absolute path in the form of File from an absolute or relative path specified in the form of a String. If path is relative, it is resolved against ConfigurationService.PNAME_SC_HOME_DIR_LOCATION and ConfigurationService.PNAME_SC_HOME_DIR_NAME, user.home, or the current working directory.

        Parameters:
        path - the absolute or relative path in the form of Stringfor/from which an absolute path in the form of File is to be returned
        cfg - the ConfigurationService to be employed by the method (invocation) if necessary
        Returns:

        an absolute path in the form of File for/from the specified path

      • getBoolean

         static boolean getBoolean(ConfigurationService cfg, String property, boolean defaultValue)

        Gets the value as a boolean of a property from either a specific ConfigurationService or System.

        Parameters:
        cfg - the ConfigurationService to get the value from or null if the property is to be retrieved from System
        property - the name of the property to get
        defaultValue - the value to be returned if property is not associated with a value
        Returns:

        the value as a boolean of property retrieved from either cfg or System

      • getInt

         static int getInt(ConfigurationService cfg, String property, int defaultValue)

        Gets the value as an int of a property from either a specific ConfigurationService or System.

        Parameters:
        cfg - the ConfigurationService to get the value from or null if the property is to be retrieved from System
        property - the name of the property to get
        defaultValue - the value to be returned if property is not associated with a value
        Returns:

        the value as an int of property retrieved from either cfg or System

      • getLong

         static long getLong(ConfigurationService cfg, String property, long defaultValue)

        Gets the value as an long of a property from either a specific ConfigurationService or System.

        Parameters:
        cfg - the ConfigurationService to get the value from or null if the property is to be retrieved from System
        property - the name of the property to get
        defaultValue - the value to be returned if property is not associated with a value
        Returns:

        the value as an long of property retrieved from either cfg or System

      • getString

         static String getString(ConfigurationService cfg, String property, String defaultValue)

        Gets the value as a String of a property from either a specific ConfigurationService or System.

        Parameters:
        cfg - the ConfigurationService to get the value from or null if the property is to be retrieved from System
        property - the name of the property to get
        defaultValue - the value to be returned if property is not associated with a value
        Returns:

        the value as a String of property retrieved from either cfg or System

      • getString

         static String getString(ConfigurationService cfg, String property, String propertyAlternative, String defaultValue)

        Gets the value as a String of a property from either a specific ConfigurationService or System.

        Parameters:
        cfg - the ConfigurationService to get the value from or null if the property is to be retrieved from System
        property - the name of the property to get
        propertyAlternative - an alternative name of the property
        defaultValue - the value to be returned if property is not associated with a value
        Returns:

        the value as a String of property retrieved from either cfg or System