public abstract class PropertyMgr extends Object
Constructor and Description |
---|
PropertyMgr()
Constructs a new PropertyMgr.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public PropertyMgr()
public abstract String get(String name)
name
- the property keypublic String get(String name, String backup)
name
- the property keybackup
- value to return if the property for the specified key is not foundpublic boolean getBoolean(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(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 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 valuepublic abstract void save() throws IOException
IOException