Module de.carne

Class Preference<T>

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Preference​(java.lang.String key, T defaultValue)
      Constructs a new Preference instance.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      T defaultValue()
      Gets this instance's default preference value.
      T get​(java.util.prefs.Preferences prefs)
      Gets this instance's preference value.
      abstract T get​(java.util.prefs.Preferences prefs, T def)
      Gets this instance's preference value.
      java.lang.String key()
      Gets this instance's preference key.
      abstract void put​(java.util.prefs.Preferences prefs, T value)
      Sets this instance's preference value.
      void remove​(java.util.prefs.Preferences prefs)
      Removes this instance's preference value.
      • Methods inherited from class java.lang.Object

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

      • Preference

        protected Preference​(java.lang.String key,
                             T defaultValue)
        Constructs a new Preference instance.
        Parameters:
        key - the preference key to access.
        defaultValue - the default preference value to use.
    • Method Detail

      • key

        public final java.lang.String key()
        Gets this instance's preference key.
        Returns:
        this instance's preference key.
      • defaultValue

        public final T defaultValue()
        Gets this instance's default preference value.
        Returns:
        this instance's default preference value.
      • get

        public T get​(java.util.prefs.Preferences prefs)
        Gets this instance's preference value.
        Parameters:
        prefs - the Preferences object to get the value from.
        Returns:
        the retrieved preference value.
      • get

        public abstract T get​(java.util.prefs.Preferences prefs,
                              T def)
        Gets this instance's preference value.
        Parameters:
        prefs - the Preferences object to get the value from.
        def - the default preference value to return in case the preference is not defined.
        Returns:
        the retrieved preference value.
      • put

        public abstract void put​(java.util.prefs.Preferences prefs,
                                 T value)
        Sets this instance's preference value.
        Parameters:
        prefs - the Preferences object to set the value into.
        value - the preference value to set.
      • remove

        public void remove​(java.util.prefs.Preferences prefs)
        Removes this instance's preference value.
        Parameters:
        prefs - the Preferences object to remove the value from.