public class TypedProperties extends Properties
Properties
class to provide accessors that convert values to certain
types, using default values if a conversion is not possible.defaults
Constructor and Description |
---|
TypedProperties()
Default constructor that returns an empty instance
|
TypedProperties(Properties p)
Copy constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
getBooleanProperty(String key,
boolean defaultValue) |
boolean |
getBooleanProperty(String key,
boolean defaultValue,
boolean doStringReplace) |
int |
getIntProperty(String key,
int defaultValue) |
int |
getIntProperty(String key,
int defaultValue,
boolean doStringReplace) |
long |
getLongProperty(String key,
long defaultValue) |
long |
getLongProperty(String key,
long defaultValue,
boolean doStringReplace) |
String |
getProperty(String key,
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(String key,
String value) |
static TypedProperties |
toTypedProperties(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
public TypedProperties(Properties p)
p
- properties instance to from. If null, then it is treated as an empty Properties instance.public TypedProperties()
public static TypedProperties toTypedProperties(Properties p)
Properties
instance to an instance of TypedProperties, if needed.p
- properties to convert.public int getIntProperty(String key, int defaultValue)
public int getIntProperty(String key, int defaultValue, boolean doStringReplace)
public long getLongProperty(String key, long defaultValue)
public long getLongProperty(String key, long defaultValue, boolean doStringReplace)
public boolean getBooleanProperty(String key, boolean defaultValue)
public boolean getBooleanProperty(String key, boolean defaultValue, boolean doStringReplace)
public String getProperty(String key, 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(String key, String value)
setProperty
in class Properties
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.