Class UserPreferences

java.lang.Object
is.codion.common.model.UserPreferences

public final class UserPreferences extends Object
A utility class for working with user preferences
  • Method Details

    • get

      public static @Nullable String get(String key)
      Parameters:
      key - the key identifying the preference
      Returns:
      the user preference associated with the given key
    • get

      public static String get(String key, String defaultValue)
      Parameters:
      key - the key identifying the preference
      defaultValue - the default value if no preference is available
      Returns:
      the user preference associated with the given key
      Throws:
      NullPointerException - in case defaultValue is null
    • set

      public static void set(String key, String value)
      Parameters:
      key - the key to use to identify the preference
      value - the preference value to associate with the given key
    • remove

      public static void remove(String key)
      Removes the preference associated with the given key
      Parameters:
      key - the key to use to identify the preference to remove
    • flush

      public static void flush() throws BackingStoreException
      Flushes the preferences to disk
      Throws:
      BackingStoreException - in case of a backing store failure