Interface ILcyPropertyConverter

All Known Implementing Classes:
ALcyPreferencesPropertyConverter, ALcyWorkspacePropertyConverter, TLcyCompositePropertyConverter

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 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 Type
    Method
    Description
    void
    Modifies the given ALcyProperties so that String properties representing Objects are converted to these Objects.
    void
    Modifies the given ALcyProperties so that all Object values are converted to one or more String values.
  • Method Details

    • convertBeforeEncode

      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.

      Parameters:
      aPropertiesSFCT - The ALcyProperties to modify. Never null.
    • convertAfterDecode

      void convertAfterDecode(ALcyProperties aPropertiesSFCT)

      Modifies the given ALcyProperties so that String properties representing Objects are converted to these Objects.

      This method should remove the String properties from which it constructs the Object. Only the Object property should remain.

      Parameters:
      aPropertiesSFCT - The properties to modify.