|
XProperties 1.0.3 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectat.spardat.properties.XProperties
Root Class for accessing Properties. XProperties instances are the primary
way to access properties. The properties are loaded automatically on first access.
Use the static methods to get a concrete XProperties instance.
The properties shall be defined in "packages" similary to java classes.
Each XProperties instance is initialized with a package name. If you
definie a property named "at.spardat.sample.a=0", you shall instantiate
a XProperties instance by calling node=XProperties.getNode(Sample.class)
and access the property by calling node.get("a")
| Constructor Summary | |
protected |
XProperties(java.lang.String value)
TODO KDM: hier pruefen ob richtig initialisiert wurde XProperties constructor. |
| Method Summary | |
java.lang.String |
get(java.lang.String key)
Access to the property with the name "basename+key". |
java.lang.String |
get(java.lang.String key,
java.lang.String defaultValue)
Access to the property with the name "basename+key". |
static java.util.Iterator |
getAllKeys()
Liefert alle vorhandenen PropertyKeys |
java.lang.String |
getBaseName()
|
boolean |
getBoolean(java.lang.String key)
Access to the property with the name "basename+key". |
boolean |
getBoolean(java.lang.String key,
boolean defaultValue)
Access to the property with the name "basename+key". |
java.util.Date |
getDate(java.lang.String key)
Access to the property with the name "basename+key". |
java.util.Date |
getDate(java.lang.String key,
java.util.Date defaultValue)
Access to the property with the name "basename+key". |
double |
getDouble(java.lang.String key)
Access to the property with the name "basename+key". |
double |
getDouble(java.lang.String key,
double defaultValue)
Access to the property with the name "basename+key". |
float |
getFloat(java.lang.String key)
Access to the property with the name "basename+key". |
float |
getFloat(java.lang.String key,
float defaultValue)
Access to the property with the name "basename+key". |
java.util.Iterator |
getGroupProperties(java.lang.String propertyName)
Tries to find subnodes of this XProperties node which start with name propertyName
and a number starting with "1" (e.g. at.spardat.sample.group1).
|
java.util.Iterator |
getGroupProperties(java.lang.String propertyName,
int start)
Tries to find subnodes of this XProperties node which start with name propertyName
and a number starting with start (e.g. at.spardat.sample.group1).
|
int |
getInt(java.lang.String key)
Access to the property with the name "basename+key". |
int |
getInt(java.lang.String key,
int defaultValue)
Access to the property with the name "basename+key". |
java.util.Iterator |
getKeys()
Returns an Iterator to iterate over the names of the properties which are defined on this node. |
long |
getLong(java.lang.String key)
Access to the property with the name "basename+key". |
long |
getLong(java.lang.String key,
long defaultValue)
Access to the property with the name "basename+key". |
protected java.lang.String |
getMustProperty(java.lang.String key)
Internal method to access a raw property value |
static XProperties |
getNode(java.lang.Class clazz)
get the preferences node for the package of the given class |
static XProperties |
getNodeOfPackage(java.lang.String packageName)
get the preferences node for the given package This method should not be used extensivly as it breaks some sort of encapsulation. |
protected java.lang.String |
getProperty(java.lang.String key)
Internal method to access a raw property value |
static java.lang.String |
getPropertyMeta(java.lang.String prop)
Liefert zum übergebenen PropertyKey die diesbezüglich konfigurierten Informationen. |
static XProperties |
getRoot()
get the root preferences node (no associated package) |
XProperties |
getSubNode(java.lang.String node)
Get a new XProperties instance for a subnode of this node. |
java.util.Date |
getTime(java.lang.String key)
Access to the property with the name "basename+key". |
java.util.Date |
getTime(java.lang.String key,
java.util.Date defaultValue)
Access to the property with the name "basename+key". |
static XProperties |
userNodeForPackage(java.lang.Class clazz)
Deprecated. for compatibility to Preferences API |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
protected XProperties(java.lang.String value)
value - basename this instance shall refer to| Method Detail |
public static XProperties getNode(java.lang.Class clazz)
clazz - The class where the packagename defines the base name for
property access
public XProperties getSubNode(java.lang.String node)
node - the name of the subnode
public static XProperties getRoot()
public static XProperties getNodeOfPackage(java.lang.String packageName)
packageName - name of the package the XProperties shall refer to
public static XProperties userNodeForPackage(java.lang.Class clazz)
clazz - The class where the packagename defines the base name for
property access
getNode(java.lang.Class)public java.lang.String getBaseName()
protected java.lang.String getProperty(java.lang.String key)
key - the key of this property without the basename
protected java.lang.String getMustProperty(java.lang.String key)
throws PropertyUnknownException
key - the key of this property without the basename
PropertyUnknownException - if no property with the given name was found
public java.lang.String get(java.lang.String key,
java.lang.String defaultValue)
key - the name of the propertydefaultValue - the defaultvalue if no property is defined
public int getInt(java.lang.String key,
int defaultValue)
int value.
key - the name of the propertydefaultValue - the defaultvalue if no property is defined
java.lang.NumberFormatException - if the property may not be converted to an int
public float getFloat(java.lang.String key,
float defaultValue)
float value.
key - the name of the propertydefaultValue - the defaultvalue if no property is defined
java.lang.NumberFormatException - if the property may not be converted to an float
public double getDouble(java.lang.String key,
double defaultValue)
double value.
key - the name of the propertydefaultValue - the defaultvalue if no property is defined
java.lang.NumberFormatException - if the property may not be converted to an double
public long getLong(java.lang.String key,
long defaultValue)
long value.
key - the name of the propertydefaultValue - the defaultvalue if no property is defined
java.lang.NumberFormatException - if the property may not be converted to an long
public boolean getBoolean(java.lang.String key,
boolean defaultValue)
boolean value.
key - the name of the propertydefaultValue - the defaultvalue if no property is defined
public java.util.Date getDate(java.lang.String key,
java.util.Date defaultValue)
throws java.text.ParseException
java.util.Date by using the formating pattern "DD.MM.YYYY".
key - the name of the propertydefaultValue - the defaultvalue if no property is defined
java.text.ParseException - if the conversion fails
public java.util.Date getTime(java.lang.String key,
java.util.Date defaultValue)
throws java.text.ParseException
java.util.Date by using the formating pattern "HH:MM:SS".
key - the name of the propertydefaultValue - the defaultvalue if no property is defined
java.text.ParseException - if the conversion fails
public java.lang.String get(java.lang.String key)
throws PropertyUnknownException
key - the name of the property
PropertyUnknownException - if no property was found.
public int getInt(java.lang.String key)
throws PropertyUnknownException
key - the name of the property
PropertyUnknownException - if no property was found.
java.lang.NumberFormatException - if the property conversion to int fails
public float getFloat(java.lang.String key)
throws PropertyUnknownException
key - the name of the property
PropertyUnknownException - if no property was found.
java.lang.NumberFormatException - if the property conversion to float fails
public double getDouble(java.lang.String key)
throws PropertyUnknownException
key - the name of the property
PropertyUnknownException - if no property was found.
java.lang.NumberFormatException - if the property conversion to double fails
public long getLong(java.lang.String key)
throws PropertyUnknownException
key - the name of the property
PropertyUnknownException - if no property was found.
java.lang.NumberFormatException - if the property conversion to long fails
public boolean getBoolean(java.lang.String key)
throws PropertyUnknownException
key - the name of the property
PropertyUnknownException - if no property was found.
java.lang.NumberFormatException - if the property conversion to boolean fails
public java.util.Date getDate(java.lang.String key)
throws PropertyUnknownException,
java.text.ParseException
key - the name of the property
PropertyUnknownException - if no property was found.
java.text.ParseException - if the property conversion fails
public java.util.Date getTime(java.lang.String key)
throws PropertyUnknownException,
java.text.ParseException
key - the name of the property
PropertyUnknownException - if no property was found.
java.text.ParseException - if the property conversion failspublic java.util.Iterator getKeys()
public java.util.Iterator getGroupProperties(java.lang.String propertyName)
propertyName
and a number starting with "1" (e.g. at.spardat.sample.group1).
The returned Iterator contains an XProperties instance for each found subnode.
propertyName - the basename of the subnode without the counter
for a sample
public java.util.Iterator getGroupProperties(java.lang.String propertyName,
int start)
propertyName
and a number starting with start (e.g. at.spardat.sample.group1).
The returned Iterator contains an XProperties instance for each found subnode.
propertyName - the basename of the subnode without the counterstart - the start number for the counter
for a samplepublic static java.lang.String getPropertyMeta(java.lang.String prop)
prop -
public static java.util.Iterator getAllKeys()
|
XProperties 1.0.3 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||