|
||||||||||
| 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 String |
get(String name)
Returns the property associated with the specified key or null if the property was not found. |
String |
get(String name,
String backup)
Returns the property associated with the specified key. |
boolean |
getBoolean(String name,
boolean backup)
Returns the property associated with the specified key as a boolean value. |
int |
getInt(String name,
int backup)
Returns the property associated with the specified key as a integer value. |
String |
getRequired(String name)
Returns the value corresponding to the specified key. |
boolean |
getRequiredBoolean(String name)
|
int |
getRequiredInt(String name)
|
abstract void |
save()
Saves any properties that were set previously. |
abstract String |
set(String name,
String backup)
Sets the property associated with the specified key. |
void |
setUsage(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 String get(String name)
name - the property key
public String get(String name,
String backup)
name - the property keybackup - value to return if the property for the specified key is not found
public boolean getBoolean(String name,
boolean backup)
yes, 1, trueelse 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(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 String getRequired(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(String name)
public int getRequiredInt(String name)
public abstract String set(String name,
String backup)
name - the property keybackup - the property value
public abstract void save()
throws IOException
IOExceptionpublic void setUsage(String str)
str - Usage information
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||