|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jbind.util.other.Prefs
Base class for managing preferences. Derived classes can use the doMain(java.lang.String[])
method to easily create a main method to manage the preferences.
Constructor Summary | |
protected |
Prefs(boolean aSystemNotUser)
Creates a prefs object that manages the preferences of class this instance belongs to. |
Method Summary | |
protected int |
doAcceptArgument(java.lang.String[] anArgs,
int anIndex)
Hook method to accept an argument. |
protected void |
doMain(java.lang.String[] anArgs)
Manages the preferences by applying the arguments supplied in an argument array. |
protected void |
doResetPrefs()
Hook method that is called if the "reset" option is handled. |
protected java.util.prefs.Preferences |
getPrefs()
Gets the preferences of the class of this instance. |
protected java.util.prefs.Preferences |
getPrefs(java.lang.String aPath)
Gets preferences addressed by an either relative or absolute path. |
protected void |
resetPrefs()
|
protected void |
usage()
Prints usage information for the doMain(java.lang.String[]) method on Console.err . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected Prefs(boolean aSystemNotUser)
aSystemNotUser
- Determines if user or system preferences are to be
managed.Method Detail |
protected java.util.prefs.Preferences getPrefs()
protected void resetPrefs()
protected java.util.prefs.Preferences getPrefs(java.lang.String aPath)
aPath
- (required).
protected void usage()
doMain(java.lang.String[])
method on Console.err
.
protected void doMain(java.lang.String[] anArgs)
anArgs
- (required).protected void doResetPrefs()
Subclasses should implement this method by setting default values for the various preferences. This enables one to first reset the preferences and then to export them. The exported preferences should contain enough structural information to allow manual editing, i.e. ideally all possible preference keys with default values are present.
The default implementation does nothing.
protected int doAcceptArgument(java.lang.String[] anArgs, int anIndex)
The default implementation returns -1, indicating that it can not handle the argument.
anArgs
- (required). The argument array that was supplied
to the doMain(java.lang.String[])
method.anIndex
- The index of the argument in the argument array that has to
be accept.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |