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 String
s 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 TypeMethodDescriptionvoid
convertAfterDecode
(ALcyProperties aPropertiesSFCT) Modifies the givenALcyProperties
so thatString
properties representingObject
s are converted to theseObject
s.void
convertBeforeEncode
(ALcyProperties aPropertiesSFCT) Modifies the givenALcyProperties
so that allObject
values are converted to one or moreString
values.
-
Method Details
-
convertBeforeEncode
Modifies the given
ALcyProperties
so that allObject
values are converted to one or moreString
values.This method should remove the original
Object
that it encodes. Only theString
property or properties should remain.- Parameters:
aPropertiesSFCT
- TheALcyProperties
to modify. Nevernull
.
-
convertAfterDecode
Modifies the given
ALcyProperties
so thatString
properties representingObject
s are converted to theseObject
s.This method should remove the
String
properties from which it constructs theObject
. Only theObject
property should remain.- Parameters:
aPropertiesSFCT
- The properties to modify.
-