Class SettingsHelper

java.lang.Object
io.jmix.ui.settings.SettingsHelper

public final class SettingsHelper extends Object
Utility class for working with component settings.
  • Field Details

    • gson

      protected static final com.google.gson.Gson gson
  • Method Details

    • createSettings

      public static <T extends ComponentSettings> T createSettings(Class<T> settingsClass)
      Creates instance of settings class.
      Type Parameters:
      T - any settings class that extends ComponentSettings
      Parameters:
      settingsClass - class of component settings
      Returns:
      instance of component settings
    • createSettings

      public static <T extends ComponentSettings> T createSettings(Class<T> settingsClass, @Nullable String id)
      Creates instance of settings class with provided id.
      Type Parameters:
      T - any settings class that extends ComponentSettings
      Parameters:
      settingsClass - class of component settings
      id - component id
      Returns:
      instance of component settings
    • toComponentSettings

      @Nullable public static <T extends ComponentSettings> T toComponentSettings(String settings, Class<T> settingsClass)
      Converts JSON string representation of settings to POJO.
      Type Parameters:
      T - any settings class that extends ComponentSettings
      Parameters:
      settings - JSON string representation of settings
      settingsClass - POJO class of settings
      Returns:
      instance of component settings
    • toSettingsString

      public static String toSettingsString(ComponentSettings settings)
      Converts settings from POJO to JSON string representation.
      Parameters:
      settings - component settings
      Returns:
      JSON string representation of component settings