textbender.g.util.prefs
Class StringPreference

java.lang.Object
  extended by Preference
      extended by StringPreference
Direct Known Subclasses:
StringPreferenceDC

public class StringPreference
extends Preference

A string in a preference node.


Field Summary
 
Fields inherited from class Preference
key, preferences
 
Constructor Summary
StringPreference(Preferences preferences, String key, String def)
          Creates a StringPreference.
 
Method Summary
 String get()
          Retrieves the value of this preference from storage.
 String getDefault()
          Returns the default value of this preference.
 void put(String value)
          Stores a new value for the preference.
 void setDefault(String newDefault)
          Sets the default value, per getDefault().
 
Methods inherited from class Preference
key, preferences, remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringPreference

public StringPreference(Preferences preferences,
                        String key,
                        String def)
Creates a StringPreference.

Parameters:
preferences - per preferences()
key - per key()
def - default per getDefault()
Method Detail

get

public String get()
Retrieves the value of this preference from storage. Equivalent to preferences.get(key,default)

Returns:
value if any was stored; else the default

getDefault

public String getDefault()
Returns the default value of this preference.


setDefault

public void setDefault(String newDefault)
Sets the default value, per getDefault().


put

public void put(String value)
Stores a new value for the preference. Equivalent to preferences.put(key,value).

Parameters:
value - new value of the preference