public class TypedProperties
extends java.util.Properties
Properties
class to provide accessors that convert values to certain
types, using default values if a conversion is not possible.Modifier and Type | Field and Description |
---|---|
private static Log |
log |
private static long |
serialVersionUID
The serialVersionUID
|
Constructor and Description |
---|
TypedProperties()
Default constructor that returns an empty instance
|
TypedProperties(java.util.Properties p)
Copy constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
getBooleanProperty(java.lang.String key,
boolean defaultValue) |
boolean |
getBooleanProperty(java.lang.String key,
boolean defaultValue,
boolean doStringReplace) |
int |
getIntProperty(java.lang.String key,
int defaultValue) |
int |
getIntProperty(java.lang.String key,
int defaultValue,
boolean doStringReplace) |
long |
getLongProperty(java.lang.String key,
long defaultValue) |
long |
getLongProperty(java.lang.String key,
long defaultValue,
boolean doStringReplace) |
java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultValue,
boolean doStringReplace)
Get the property associated with the key, optionally applying string property replacement as defined in
StringPropertyReplacer.replaceProperties(java.lang.String) to the result. |
TypedProperties |
setProperty(java.lang.String key,
java.lang.String value) |
static TypedProperties |
toTypedProperties(java.util.Properties p)
Factory method that converts a JDK
Properties instance to an instance of TypedProperties, if needed. |
getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, store, store, storeToXML, storeToXML, stringPropertyNames
private static final long serialVersionUID
private static final Log log
public TypedProperties(java.util.Properties p)
p
- properties instance to from. If null, then it is treated as an empty Properties instance.public TypedProperties()
public static TypedProperties toTypedProperties(java.util.Properties p)
Properties
instance to an instance of TypedProperties, if needed.p
- properties to convert.public int getIntProperty(java.lang.String key, int defaultValue)
public int getIntProperty(java.lang.String key, int defaultValue, boolean doStringReplace)
public long getLongProperty(java.lang.String key, long defaultValue)
public long getLongProperty(java.lang.String key, long defaultValue, boolean doStringReplace)
public boolean getBooleanProperty(java.lang.String key, boolean defaultValue)
public boolean getBooleanProperty(java.lang.String key, boolean defaultValue, boolean doStringReplace)
public java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue, boolean doStringReplace)
StringPropertyReplacer.replaceProperties(java.lang.String)
to the result.key
- the hashtable key.defaultValue
- a default value.doStringReplace
- boolean indicating whether to apply string property replacementpublic TypedProperties setProperty(java.lang.String key, java.lang.String value)
setProperty
in class java.util.Properties