Interface ModeSettingsConverter<A,B>

Type Parameters:
A - the type of properties outside
B - the type of properties that represent the outside properties
All Known Implementing Classes:
LocationSettingConverter

public interface ModeSettingsConverter<A,B>
A converter converts properties from the outside to the inner world. It is used by the ModeSettings to store data in memory, a converter should ensure that the data does not reference any object from the application (such that garbage collection works).
Author:
Benjamin Sigg
  • Method Details

    • convertToWorld

      A convertToWorld(B b)
      Converts a property from the outside world into the world of this setting.
      Parameters:
      b - a property from outside
      Returns:
      a property from inside
    • convertToSetting

      B convertToSetting(A a)
      Converts a property from the inside world into the world outside.
      Parameters:
      a - the property from inside
      Returns:
      a property from outside
    • writeProperty

      void writeProperty(B b, DataOutputStream out) throws IOException
      Writes a single property of this setting.
      Parameters:
      b - the property to write
      out - the stream to write into
      Throws:
      IOException - if an I/O-error occurs
    • readProperty

      B readProperty(DataInputStream in) throws IOException
      Reads a single property.
      Parameters:
      in - the stream to read from
      Returns:
      the property that has been read.
      Throws:
      IOException - if an I/O-error occurs
    • writePropertyXML

      void writePropertyXML(B b, XElement element)
      Writes a single property as xml element.
      Parameters:
      b - the property to write
      element - the element to write into, the attributes of the element must not be changed
    • readPropertyXML

      B readPropertyXML(XElement element)
      Reads a single property.
      Parameters:
      element - the element to read the property from
      Returns:
      the new property