Class PropertiesHelper

java.lang.Object
com.perforce.p4java.util.PropertiesHelper

public class PropertiesHelper extends Object
Properties helper class with generally useful methods.
  • Constructor Details

    • PropertiesHelper

      public PropertiesHelper()
  • Method Details

    • getProperty

      public static String getProperty(Properties props, String[] keys)
      Parameters:
      props - props
      keys - keys
      Returns:
      the first property string value found from the passed-in properties with the specified keys.
    • getProperty

      public static String getProperty(Properties props, String[] keys, String defaultValue)
      Parameters:
      props - props
      keys - keys
      defaultValue - defaultValue
      Returns:
      the first property string value found from the passed-in properties with the specified keys. If it can't find a value, then return the passed-in defaultValue.
    • getPropertyAsInt

      public static int getPropertyAsInt(Properties props, String[] keys, int defaultValue)
      Parameters:
      props - props
      keys - keys
      defaultValue - defaultValue
      Returns:
      the first property value found as an int, if possible. If it can't find a value, then return the passed-in defaultValue.
    • getPropertyAsLong

      public static long getPropertyAsLong(Properties props, String[] keys, long defaultValue)
      Parameters:
      props - props
      keys - keys
      defaultValue - defaultValue
      Returns:
      the property value as a long, if possible. If it can't find a value by the specified key, then return the passed-in defaultValue.
    • getPropertyByKeys

      public static String getPropertyByKeys(Properties props, String key, String alternativeKey, String defaultValue)
    • getPropertyByKeys

      public static String getPropertyByKeys(Properties props, String key, String alternativeKey)
    • isExistProperty

      public static boolean isExistProperty(Properties props, String key, String alternativeKey, boolean defaultValue)