public class PropertyUtil
extends java.lang.Object
Constructor and Description |
---|
PropertyUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getPropertyOrDefault(java.lang.Class<?> referenceClass,
java.lang.String propertyFile,
java.lang.String key,
java.lang.String defaultValue)
Get the value of a property or a default value if there's an error retrieving the property key.
|
public static java.lang.String getPropertyOrDefault(java.lang.Class<?> referenceClass, java.lang.String propertyFile, java.lang.String key, java.lang.String defaultValue)
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.Copyright © 2019. All rights reserved.