com.palantir.opensource.sysmon.util
Class PropertiesUtils
java.lang.Object
com.palantir.opensource.sysmon.util.PropertiesUtils
public class PropertiesUtils
- extends Object
A small library to make dealing with numeric values in a Properties object easier,
cleaner, and type safe.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PropertiesUtils
public PropertiesUtils()
extractInteger
public static final int extractInteger(Properties p,
String key,
int defaultValue)
throws NumberFormatException
- Returns the
Integer value at the specified key.
- Parameters:
p - Properties object to extract values fromkey - key to be extracteddefaultValue - default value to use if specified key doesn't exist
- Returns:
- the
Integer stored in the Properties object.
- Throws:
NumberFormatException - if the value stored in the Properties object
does not parse as an Integer.
extractLong
public static final long extractLong(Properties p,
String key,
long defaultValue)
throws NumberFormatException
- Returns the
Long value at the specified key.
- Parameters:
p - Properties object to extract values fromkey - key to be extracteddefaultValue - default value to use if specified key doesn't exist
- Returns:
- the
Long stored in the Properties object.
- Throws:
NumberFormatException - if the value stored in the Properties object
does not parse as an Long.
Copyright © 2012 Palantir Technologies. All Rights Reserved.