Package com.google.cloud.hadoop.util
Class PropertyUtil
- java.lang.Object
-
- com.google.cloud.hadoop.util.PropertyUtil
-
public class PropertyUtil extends Object
Helpers for interacting with properties files
-
-
Constructor Summary
Constructors Constructor Description PropertyUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetPropertyOrDefault(Class<?> referenceClass, String propertyFile, String key, String defaultValue)Get the value of a property or a default value if there's an error retrieving the property key.
-
-
-
Method Detail
-
getPropertyOrDefault
public static String getPropertyOrDefault(Class<?> referenceClass, String propertyFile, String key, String defaultValue)
Get the value of a property or a default value if there's an error retrieving the property key.- Parameters:
referenceClass- The class which should be used to find the property file. The property file is expected to be packaged in the same directory as this class.propertyFile- The name of the property file to be read.key- The property key to find in the property file.defaultValue- The value to return if no property with the given key is found or if the property file cannot be found.- Returns:
- The value specified in the property file or defaultValue if an error occurs or if the key could not be found
-
-