|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfc.util.PropertyMgr
public abstract class PropertyMgr
Implementations help load and manage properties from various sources including java property files, databases, custom file formats etc. Regardless of where the properties are loaded from, each property consists of a pair of name and value strings.
Constructor Summary | |
---|---|
PropertyMgr()
Constructs a new PropertyMgr. |
Method Summary | |
---|---|
abstract java.lang.String |
get(java.lang.String name)
Returns the property associated with the specified key or null if the property was not found. |
java.lang.String |
get(java.lang.String name,
java.lang.String backup)
Returns the property associated with the specified key. |
boolean |
getBoolean(java.lang.String name,
boolean backup)
Returns the property associated with the specified key as a boolean value. |
int |
getInt(java.lang.String name,
int backup)
Returns the property associated with the specified key as a integer value. |
java.lang.String |
getRequired(java.lang.String name)
Returns the value corresponding to the specified key. |
boolean |
getRequiredBoolean(java.lang.String name)
|
int |
getRequiredInt(java.lang.String name)
|
abstract void |
save()
Saves any properties that were set previously. |
abstract java.lang.String |
set(java.lang.String name,
java.lang.String backup)
Sets the property associated with the specified key. |
void |
setUsage(java.lang.String str)
Specify program usage information to be output when an error occurs. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PropertyMgr()
Method Detail |
---|
public abstract java.lang.String get(java.lang.String name)
name
- the property keypublic java.lang.String get(java.lang.String name, java.lang.String backup)
name
- the property keybackup
- value to return if the property for the specified key is not found
public boolean getBoolean(java.lang.String name, boolean backup)
yes, 1, true
else false is returned.
- Parameters:
name
- the property keybackup
- value to return if the property for the specified property is not present- Returns:
- value of specified key or backup string
public int getInt(java.lang.String name, int backup)
Integer.parseInt(String)
call), the backup value will be
returned.
name
- the property keybackup
- value to return if the property for the
specified property is not present
public java.lang.String getRequired(java.lang.String name)
handleError(java.lang.String)
method
is called, which by default prints a stack trace and exits
the application.
If the handleError method is overriden to not exit the application, then this method will return null if the specified key is not found.
name
- the property keypublic boolean getRequiredBoolean(java.lang.String name)
public int getRequiredInt(java.lang.String name)
public abstract java.lang.String set(java.lang.String name, java.lang.String backup)
name
- the property keybackup
- the property value
public abstract void save() throws java.io.IOException
java.io.IOException
public void setUsage(java.lang.String str)
str
- Usage information
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |