|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.Dictionary<K,V> java.util.Hashtable<Object,Object> java.util.Properties org.apache.openjpa.lib.util.TypedProperties
public class TypedProperties
A specialization of the Properties
map type with added
convenience methods to retrieve and set options as primitive values.
The internal representation of all data is kept in string form.
Field Summary |
---|
Fields inherited from class java.util.Properties |
---|
defaults |
Constructor Summary | |
---|---|
TypedProperties()
Default constructor. |
|
TypedProperties(Properties defaults)
Construct the properties instance with the given set of defaults. |
Method Summary | |
---|---|
boolean |
getBooleanProperty(String key)
Return the property under the given key as a boolean, or false if it does not exist and has no set default. |
boolean |
getBooleanProperty(String key,
boolean def)
Return the property under the given key as a boolean, or the given default if it does not exist. |
double |
getDoubleProperty(String key)
Return the property under the given key as a double, or 0 if it does not exist and has no set default. |
double |
getDoubleProperty(String key,
double def)
Return the property under the given key as a double, or the given default if it does not exist. |
float |
getFloatProperty(String key)
Return the property under the given key as a float, or 0 if it does not exist and has no set default. |
float |
getFloatProperty(String key,
float def)
Return the property under the given key as a float, or the given default if it does not exist. |
int |
getIntProperty(String key)
Return the property under the given key as an int, or 0 if it does not exist and has no set default. |
int |
getIntProperty(String key,
int def)
Return the property under the given key as an int, or the given default if it does not exist. |
long |
getLongProperty(String key)
Return the property under the given key as a long, or 0 if it does not exist and has no set default. |
long |
getLongProperty(String key,
long def)
Return the property under the given key as a double, or the given default if it does not exist. |
boolean |
removeBooleanProperty(String key)
Remove the property under the given key as a boolean. |
boolean |
removeBooleanProperty(String key,
boolean def)
Remove the property under the given key as a boolean, or return the given default if it does not exist. |
double |
removeDoubleProperty(String key)
Remove the property under the given key as a double. |
double |
removeDoubleProperty(String key,
double def)
Remove the property under the given key as a double, or return the given default if it does not exist. |
float |
removeFloatProperty(String key)
Remove the property under the given key as a float. |
float |
removeFloatProperty(String key,
float def)
Remove the property under the given key as a float, or return the given default if it does not exist. |
int |
removeIntProperty(String key)
Remove the property under the given key as a int. |
int |
removeIntProperty(String key,
int def)
Remove the property under the given key as a int, or return the given default if it does not exist. |
long |
removeLongProperty(String key)
Remove the property under the given key as a long. |
long |
removeLongProperty(String key,
long def)
Remove the property under the given key as a long, or return the given default if it does not exist. |
String |
removeProperty(String key)
Remove the given property. |
String |
removeProperty(String key,
String def)
Remove the given property, or return the given default if it does not exist. |
void |
setProperty(String key,
boolean val)
Set the given key to a string version of the given value. |
void |
setProperty(String key,
double val)
Set the given key to a string version of the given value. |
void |
setProperty(String key,
float val)
Set the given key to a string version of the given value. |
void |
setProperty(String key,
int val)
Set the given key to a string version of the given value. |
void |
setProperty(String key,
long val)
Set the given key to a string version of the given value. |
Object |
setProperty(String key,
String val)
Overrides Properties.setProperty(String,String) to remove
the key if the given value is null . |
Methods inherited from class java.util.Properties |
---|
getProperty, getProperty, list, list, load, loadFromXML, propertyNames, save, store, storeToXML, storeToXML |
Methods inherited from class java.util.Hashtable |
---|
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TypedProperties()
public TypedProperties(Properties defaults)
Properties.Properties(Properties)
Method Detail |
---|
public boolean getBooleanProperty(String key)
public boolean getBooleanProperty(String key, boolean def)
public float getFloatProperty(String key)
NumberFormatException
- on parse errorpublic float getFloatProperty(String key, float def)
NumberFormatException
- on parse errorpublic double getDoubleProperty(String key)
NumberFormatException
- on parse errorpublic double getDoubleProperty(String key, double def)
NumberFormatException
- on parse errorpublic long getLongProperty(String key)
NumberFormatException
- on parse errorpublic long getLongProperty(String key, long def)
NumberFormatException
- on parse errorpublic int getIntProperty(String key)
NumberFormatException
- on parse errorpublic int getIntProperty(String key, int def)
NumberFormatException
- on parse errorpublic Object setProperty(String key, String val)
Properties.setProperty(String,String)
to remove
the key if the given value is null
.
setProperty
in class Properties
Properties.setProperty(String,String)
public void setProperty(String key, boolean val)
Properties.setProperty(String,String)
public void setProperty(String key, double val)
Properties.setProperty(String,String)
public void setProperty(String key, float val)
Properties.setProperty(String,String)
public void setProperty(String key, int val)
Properties.setProperty(String,String)
public void setProperty(String key, long val)
Properties.setProperty(String,String)
public String removeProperty(String key)
public String removeProperty(String key, String def)
public boolean removeBooleanProperty(String key)
public boolean removeBooleanProperty(String key, boolean def)
public double removeDoubleProperty(String key)
NumberFormatException
- on parse errorpublic double removeDoubleProperty(String key, double def)
NumberFormatException
- on parse errorpublic float removeFloatProperty(String key)
NumberFormatException
- on parse errorpublic float removeFloatProperty(String key, float def)
NumberFormatException
- on parse errorpublic int removeIntProperty(String key)
NumberFormatException
- on parse errorpublic int removeIntProperty(String key, int def)
NumberFormatException
- on parse errorpublic long removeLongProperty(String key)
NumberFormatException
- on parse errorpublic long removeLongProperty(String key, long def)
NumberFormatException
- on parse error
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |