Interface ILcyPropertyConverter
- All Known Implementing Classes:
ALcyPreferencesPropertyConverter,ALcyWorkspacePropertyConverter,TLcyCompositePropertyConverter
The concept of a ILcyPropertyConverter allows to make some modifications to an
ALcyProperties object just before they are stored, and just after they are
read.
Suppose there is a legacy property named 'foo', that is present in several persistent stores
(e.g. workspace files), which now needs to be renamed to 'foo2'. Using a
ILcyPropertyConverter, there is a hook to make the renames just after the data is
read from the persistent store.
Another use could be to convert String based properties, as they are stored in for example
text files, in more convenient Java objects after they are read. Before saving, they again need
to be converted to their String representation. An example could be a complex object such as a
java.awt.print.PageFormat, which probably requires multiple Strings to
fully configure it in a configuration file. After reading those String values, it
might be convenient to convert them into an actual java.awt.print.PageFormat. The
ILcyPropertyConverter would then remove all String properties and add
one new property with a PageFormat value in its convertAfterDecode
method. In its convertBeforeEncode method it would do the opposite: remove the
PageFormat property and add all the String properties.
-
Method Summary
Modifier and TypeMethodDescriptionvoidconvertAfterDecode(ALcyProperties aPropertiesSFCT) Modifies the givenALcyPropertiesso thatStringproperties representingObjects are converted to theseObjects.voidconvertBeforeEncode(ALcyProperties aPropertiesSFCT) Modifies the givenALcyPropertiesso that allObjectvalues are converted to one or moreStringvalues.
-
Method Details
-
convertBeforeEncode
Modifies the given
ALcyPropertiesso that allObjectvalues are converted to one or moreStringvalues.This method should remove the original
Objectthat it encodes. Only theStringproperty or properties should remain.- Parameters:
aPropertiesSFCT- TheALcyPropertiesto modify. Nevernull.
-
convertAfterDecode
Modifies the given
ALcyPropertiesso thatStringproperties representingObjects are converted to theseObjects.This method should remove the
Stringproperties from which it constructs theObject. Only theObjectproperty should remain.- Parameters:
aPropertiesSFCT- The properties to modify.
-