public interface ILcyPropertyConverter
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.
Modifier and Type | Method and Description |
---|---|
void |
convertAfterDecode(ALcyProperties aPropertiesSFCT)
Modifies the given
ALcyProperties so that String properties
representing Object s are converted to these Object s. |
void |
convertBeforeEncode(ALcyProperties aPropertiesSFCT)
Modifies the given
ALcyProperties so that all Object values are
converted to one or more String values. |
void convertBeforeEncode(ALcyProperties aPropertiesSFCT)
Modifies the given ALcyProperties
so that all Object
values are
converted to one or more String
values.
This method should remove the original Object
that it encodes. Only the
String
property or properties should remain.
aPropertiesSFCT
- The ALcyProperties
to modify. Never null
.void convertAfterDecode(ALcyProperties aPropertiesSFCT)
Modifies the given ALcyProperties
so that String
properties
representing Object
s are converted to these Object
s.
This method should remove the String
properties from which it constructs the
Object
. Only the Object
property should remain.
aPropertiesSFCT
- The properties to modify.