Package com.perforce.p4java.util
Class PropertiesHelper
- java.lang.Object
-
- com.perforce.p4java.util.PropertiesHelper
-
public class PropertiesHelper extends java.lang.Object
Properties helper class with generally useful methods.
-
-
Constructor Summary
Constructors Constructor Description PropertiesHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getProperty(java.util.Properties props, java.lang.String[] keys)
static java.lang.String
getProperty(java.util.Properties props, java.lang.String[] keys, java.lang.String defaultValue)
static int
getPropertyAsInt(java.util.Properties props, java.lang.String[] keys, int defaultValue)
static long
getPropertyAsLong(java.util.Properties props, java.lang.String[] keys, long defaultValue)
static java.lang.String
getPropertyByKeys(java.util.Properties props, java.lang.String key, java.lang.String alternativeKey)
static java.lang.String
getPropertyByKeys(java.util.Properties props, java.lang.String key, java.lang.String alternativeKey, java.lang.String defaultValue)
static boolean
isExistProperty(java.util.Properties props, java.lang.String key, java.lang.String alternativeKey, boolean defaultValue)
-
-
-
Method Detail
-
getProperty
public static java.lang.String getProperty(java.util.Properties props, java.lang.String[] keys)
- Parameters:
props
- propskeys
- keys- Returns:
- the first property string value found from the passed-in properties with the specified keys.
-
getProperty
public static java.lang.String getProperty(java.util.Properties props, java.lang.String[] keys, java.lang.String defaultValue)
- Parameters:
props
- propskeys
- keysdefaultValue
- 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(java.util.Properties props, java.lang.String[] keys, int defaultValue)
- Parameters:
props
- propskeys
- keysdefaultValue
- 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(java.util.Properties props, java.lang.String[] keys, long defaultValue)
- Parameters:
props
- propskeys
- keysdefaultValue
- 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 java.lang.String getPropertyByKeys(java.util.Properties props, java.lang.String key, java.lang.String alternativeKey, java.lang.String defaultValue)
-
getPropertyByKeys
public static java.lang.String getPropertyByKeys(java.util.Properties props, java.lang.String key, java.lang.String alternativeKey)
-
isExistProperty
public static boolean isExistProperty(java.util.Properties props, java.lang.String key, java.lang.String alternativeKey, boolean defaultValue)
-
-