Class ObjectPrefUtil

java.lang.Object
com.iamsoft.util.ui.javafx.prefs.ObjectPrefUtil

public final class ObjectPrefUtil extends Object
Load/save object attributes from/to Preferences.
  • Method Details

    • manage

      public static <T> void manage(javafx.beans.property.Property<T> pProperty, Function<String,T> pStringToValueMapper, Function<T,String> pValueToStringMapper, Class<?> pClass, String... pKeys)
    • manage

      public static <T> void manage(javafx.beans.property.Property<T> pProperty, Function<String,T> pStringToValueMapper, Function<T,String> pValueToStringMapper, Consumer<Runnable> pExecutor, Class<?> pClass, String... pKeys)
      Parameters:
      pExecutor - An executor to be used to load and save preferences on a background thread. Submitted runnables should be executed in order of arrival.
    • manage

      public static <T> void manage(javafx.beans.property.Property<T> pProperty, Function<String,T> pStringToValueMapper, Function<T,String> pValueToStringMapper, Preferences pPrefs)
      Load preferences and also save on update.
    • manage

      public static <T> void manage(javafx.beans.property.Property<T> pProperty, Function<String,T> pStringToValueMapper, Function<T,String> pValueToStringMapper, Preferences pPrefs, Consumer<Runnable> pExecutor)
      Load preferences and also save on update.
      Parameters:
      pExecutor - An executor to be used to load and save preferences on a background thread. Submitted runnables should be executed in order of arrival.
    • manage

      public static <T> void manage(javafx.beans.property.Property<T> pProperty, Function<String,T> pStringToValueMapper, Function<T,String> pValueToStringMapper, String pNodeName, Consumer<Runnable> pExecutor)
      Load preferences and also save on update.
      Parameters:
      pExecutor - An executor to be used to load and save preferences on a background thread. Submitted runnables should be executed in order of arrival.
    • manage

      public static <T> void manage(javafx.beans.property.Property<T> pProperty, Function<String,T> pStringToValueMapper, Function<T,String> pValueToStringMapper, Supplier<Preferences> pPrefsSupplier, boolean pPrefsNodeExists, Consumer<Runnable> pExecutor)
      Load preferences and also save on update.
      Parameters:
      pPrefsSupplier - A supplier to be used to obtain the Preferences node on a background thread.
      pPrefsNodeExists - Specifies whether the preferences node exists.
      pExecutor - An executor to be used to load and save preferences on a background thread. Submitted runnables should be executed in order of arrival.
    • manage

      public static <T> void manage(javafx.beans.property.Property<T> pProperty, Function<String,T> pStringToValueMapper, Function<T,String> pValueToStringMapper, javafx.beans.value.ObservableValue<Supplier<Preferences>> pPrefsSupplierProperty, boolean pPrefsNodeExists, Consumer<Runnable> pExecutor)
      Load preferences and also save on update.
      Parameters:
      pPrefsSupplierProperty - A supplier to be used to obtain the Preferences node on a background thread. Property should change only on the JavaFX thread.
      pPrefsNodeExists - Specifies whether the preferences node exists.
      pExecutor - An executor to be used to load and save preferences on a background thread. Submitted runnables should be executed in order of arrival.
    • manage

      public static <T> void manage(javafx.beans.property.Property<T> pProperty, Supplier<Preferences> pPrefsSupplier, Function<Map<String,String>,T> pPrefMapToValueMapper, Function<T,Map<String,String>> pValueToPrefMapMapper, boolean pPrefsNodeExists, Consumer<Runnable> pExecutor)
      Load preferences and also save on update.
      Parameters:
      pPrefsSupplier - A supplier to be used to obtain the Preferences node on a background thread.
      pPrefsNodeExists - Specifies whether the preferences node exists.
      pExecutor - An executor to be used to load and save preferences on a background thread. Submitted runnables should be executed in order of arrival.
    • manage

      public static <T> void manage(javafx.beans.property.Property<T> pProperty, javafx.beans.value.ObservableValue<Supplier<Preferences>> pPrefsSupplierProperty, Function<Map<String,String>,T> pPrefMapToValueMapper, Function<T,Map<String,String>> pValueToPrefMapMapper, boolean pPrefsNodeExists, Consumer<Runnable> pExecutor)
      Load preferences and also save on update.
      Parameters:
      pPrefsSupplierProperty - A supplier to be used to obtain the Preferences node on a background thread. Property should change only on the JavaFX thread.
      pPrefsNodeExists - Specifies whether the preferences node exists.
      pExecutor - An executor to be used to load and save preferences on a background thread. Submitted runnables should be executed in order of arrival.
    • save

      public static <T> void save(T pValue, Function<T,Map<String,String>> pValueToPrefMapMapper, Preferences pPreferences, Consumer<Runnable> pExecutor)