public abstract class PropertyMgr extends java.lang.Object
Constructor and Description |
---|
PropertyMgr()
Constructs a new PropertyMgr.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public PropertyMgr()
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 foundpublic boolean getBoolean(java.lang.String name, boolean backup)
yes, 1, true
else false is returned.
name
- the property keybackup
- value to return if the property for the
specified property is not presentpublic 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 presentpublic 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 valuepublic abstract void save() throws java.io.IOException
java.io.IOException
public void setUsage(java.lang.String str)
str
- Usage information