Class JosmComboBoxModel.Preferences

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.function.Function<java.lang.String,​E> readE
      A Function that builds an <E> from a String.
      private java.util.function.Function<E,​java.lang.String> writeE
      A Function that serializes <E> to a String.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Preferences​(java.util.function.Function<java.lang.String,​E> readE, java.util.function.Function<E,​java.lang.String> writeE)
      Private constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<java.lang.String> asStringList()
      Returns the model elements as list of strings.
      void load​(java.lang.String key)
      Loads the model from the JOSM preferences.
      void load​(java.lang.String key, java.util.List<java.lang.String> defaults)
      Loads the model from the JOSM preferences.
      void load​(ListProperty prop)
      Loads the model from the JOSM preferences.
      void save​(java.lang.String key)
      Saves the model to the JOSM preferences.
      void save​(ListProperty prop)
      Saves the model to the JOSM preferences.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • readE

        private final java.util.function.Function<java.lang.String,​E> readE
        A Function that builds an <E> from a String.
      • writeE

        private final java.util.function.Function<E,​java.lang.String> writeE
        A Function that serializes <E> to a String.
    • Constructor Detail

      • Preferences

        private Preferences​(java.util.function.Function<java.lang.String,​E> readE,
                            java.util.function.Function<E,​java.lang.String> writeE)
        Private constructor
        Parameters:
        readE - A Function that builds an <E> from a String.
        writeE - A Function that serializes an <E> to a String
    • Method Detail

      • load

        public void load​(java.lang.String key)
        Loads the model from the JOSM preferences.
        Parameters:
        key - The preferences key
      • load

        public void load​(java.lang.String key,
                         java.util.List<java.lang.String> defaults)
        Loads the model from the JOSM preferences.
        Parameters:
        key - The preferences key
        defaults - A list of default values.
      • load

        public void load​(ListProperty prop)
        Loads the model from the JOSM preferences.
        Parameters:
        prop - The property holding the strings.
      • asStringList

        public java.util.List<java.lang.String> asStringList()
        Returns the model elements as list of strings.
        Returns:
        a list of strings
      • save

        public void save​(java.lang.String key)
        Saves the model to the JOSM preferences.
        Parameters:
        key - The preferences key
      • save

        public void save​(ListProperty prop)
        Saves the model to the JOSM preferences.
        Parameters:
        prop - The property to write to.