Class DateAccessor
java.lang.Object
org.tquadrat.foundation.config.spi.prefs.PreferenceAccessor<Date>
org.tquadrat.foundation.config.spi.prefs.DateAccessor
@ClassVersion(sourceVersion="$Id: DateAccessor.java 910 2021-05-06 21:38:06Z tquadrat $")
@API(status=STABLE,
since="0.0.1")
public final class DateAccessor
extends PreferenceAccessor<Date>
The implementation of
PreferenceAccessor
for instances of
Date.
As instances of Date do not keep a time zone, and because there
is no easy (and reliable for all locales) way to convert them to and from
Strings, they are stored to the preferences as long values.
If it is desired/required to store human readable time/date values to
the preferences, the classes from the package
java.time
should be considered for the property type.
- Author:
- Thomas Thrien (thomas.thrien@tquadrat.org)
- Version:
- $Id: DateAccessor.java 910 2021-05-06 21:38:06Z tquadrat $
- Since:
- 0.0.1
- See Also:
- UML Diagram
-
UML Diagram for "org.tquadrat.foundation.config.spi.prefs.DateAccessor"
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidreadPreference(Preferences node) Reads the preference value from the given node and writes it to the property.final voidwritePreference(Preferences node) Writes the preference value from the property and writes it to the given node.Methods inherited from class org.tquadrat.foundation.config.spi.prefs.PreferenceAccessor
getPropertyName, getter, hasKey, setter
-
Constructor Details
-
DateAccessor
Creates a newDateAccessorinstance.- Parameters:
propertyName- The name of the property.getter- The property getter.setter- The property setter.
-
-
Method Details
-
readPreference
public final void readPreference(Preferences node) throws BackingStoreException, InvalidPreferenceValueException Reads the preference value from the given node and writes it to the property.- Specified by:
readPreferencein classPreferenceAccessor<Date>- Parameters:
node- The preference node.- Throws:
BackingStoreException- There are problems on reading the given node.InvalidPreferenceValueException- The preferences value cannot be translated to the property type.
-
writePreference
Writes the preference value from the property and writes it to the given node.- Specified by:
writePreferencein classPreferenceAccessor<Date>- Parameters:
node- The preference node.- Throws:
BackingStoreException- There are problems on writing the given node.
-
