Package com.perforce.p4java.util
Class PropertiesHelper
java.lang.Object
com.perforce.p4java.util.PropertiesHelper
Properties helper class with generally useful methods.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetProperty(Properties props, String[] keys) static StringgetProperty(Properties props, String[] keys, String defaultValue) static intgetPropertyAsInt(Properties props, String[] keys, int defaultValue) static longgetPropertyAsLong(Properties props, String[] keys, long defaultValue) static StringgetPropertyByKeys(Properties props, String key, String alternativeKey) static StringgetPropertyByKeys(Properties props, String key, String alternativeKey, String defaultValue) static booleanisExistProperty(Properties props, String key, String alternativeKey, boolean defaultValue)
-
Constructor Details
-
PropertiesHelper
public PropertiesHelper()
-
-
Method Details
-
getProperty
- Parameters:
props- propskeys- keys- Returns:
- the first property string value found from the passed-in properties with the specified keys.
-
getProperty
- 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
- 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
- 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 String getPropertyByKeys(Properties props, String key, String alternativeKey, String defaultValue) -
getPropertyByKeys
-
isExistProperty
public static boolean isExistProperty(Properties props, String key, String alternativeKey, boolean defaultValue)
-