public class PropertyParserUtils extends Object
Constructor and Description |
---|
PropertyParserUtils() |
Modifier and Type | Method and Description |
---|---|
static int |
getIntegerProperty(String property,
int defaultValue,
Properties properties)
Returns Integer property value if exists.
|
static long |
getLongProperty(String property,
long defaultValue,
Properties properties)
Returns Long property value if exists.
|
static String |
getStringProperty(String property,
Properties properties)
Returns String property value if exists.
|
static Properties |
loadFromProperties(InputStream inputStream)
Load properties from Inputstream.
|
static Properties |
loadFromProperties(String propFile)
Load properties from a file path.
|
static boolean |
parseBoolean(String property,
boolean defaultValue,
Properties properties)
Helper method used to parse boolean properties.
|
public static Properties loadFromProperties(String propFile) throws IOException
propFile
- IOException
public static Properties loadFromProperties(InputStream inputStream) throws IOException
inputStream
- IOException
public static String getStringProperty(String property, Properties properties)
IllegalArgumentException
public static int getIntegerProperty(String property, int defaultValue, Properties properties)
property
- defaultValue
- properties
- public static long getLongProperty(String property, long defaultValue, Properties properties)
property
- defaultValue
- properties
- public static boolean parseBoolean(String property, boolean defaultValue, Properties properties)
property
- The String key for the propertydefaultValue
- The default value for the boolean propertyproperties
- The properties file to get property fromCopyright © 2017. All rights reserved.