Package cdc.prefs.defaults
Class DatePreference
- java.lang.Object
-
- cdc.prefs.AbstractPreference<Date>
-
- cdc.prefs.defaults.DatePreference
-
- All Implemented Interfaces:
Preference<Date>
public class DatePreference extends AbstractPreference<Date>
Date preference (node, key) pair.- Author:
- Damien Carbonne
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDatePreference.FormatEnumeration of default formats.
-
Constructor Summary
Constructors Constructor Description DatePreference(Preferences node, String key, Date def, DatePreference.Format format)DatePreference(Preferences node, String key, Date def, String pattern)Creates a date preference.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected DatefromString(String s)Converts a string to a value usingfomString.protected StringtoString(Date value)Converts a value to a string usingtoString.-
Methods inherited from class cdc.prefs.AbstractPreference
get, getDefaultValue, getKey, getNode, getValueClass, put
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface cdc.prefs.Preference
get
-
-
-
-
Constructor Detail
-
DatePreference
public DatePreference(Preferences node, String key, Date def, String pattern)
Creates a date preference.- Parameters:
node- The Preferences node.key- The preferences key.def- The default value.pattern- The format pattern.
-
DatePreference
public DatePreference(Preferences node, String key, Date def, DatePreference.Format format)
-
-
Method Detail
-
toString
protected String toString(Date value)
Description copied from class:AbstractPreferenceConverts a value to a string usingtoString.If
valueisnull, returns"".- Overrides:
toStringin classAbstractPreference<Date>- Parameters:
value- The value.- Returns:
- The corresponding string.
-
fromString
protected Date fromString(String s)
Description copied from class:AbstractPreferenceConverts a string to a value usingfomString.If
sisnullor empty, returnsnull.- Overrides:
fromStringin classAbstractPreference<Date>- Parameters:
s- The string.- Returns:
- The corresponding value.
-
-