Module org.autogui

Class GuiSwingPrefsSupports

java.lang.Object
org.autogui.swing.prefs.GuiSwingPrefsSupports

public class GuiSwingPrefsSupports extends Object
  • Constructor Details

    • GuiSwingPrefsSupports

      protected GuiSwingPrefsSupports()
  • Method Details

    • setAsList

      public static <E> void setAsList(List<E> targetList, Map<?,?> map, Class<E> type, String key)
      Type Parameters:
      E - the element type
      Parameters:
      targetList - the updated non-null list; cleared and set all elements from the map.
      map - the source map
      type - the element type
      key - the key
      Since:
      1.6.1
    • setAsList

      public static <E, V> void setAsList(List<V> targetList, Map<?,?> map, Class<E> type, String key, Function<E,V> mapper)
      Type Parameters:
      E - the element type in the JSON
      V - the actual element type of the trgetList
      Parameters:
      targetList - the updated non-null list; cleared and set all elements from the map.
      map - the source map
      type - the element type of the JSON map
      key - the key
      mapper - the mapper from a JSON element to an actual value in the list
    • setAsList

      public static <E, V> void setAsList(List<V> targetList, Object list, Class<E> type, Function<E,V> mapper)
      Type Parameters:
      E - the element type in the JSON
      V - the actual element type of the trgetList
      Parameters:
      targetList - the updated non-null list; cleared and set all elements from the list.
      list - the source list
      type - the element type of the JSON map
      mapper - the mapper from a JSON element to an actual value in the list
    • getAsListNonNull

      public static <E> List<E> getAsListNonNull(Map<?,?> map, Class<E> type, String key)
      supporting method for setting JSON values
      Type Parameters:
      E - the element type
      Parameters:
      map - the non-null map
      type - the element type
      key - the key for the map
      Returns:
      a list of map.get(key) that satifies all elements are the type.
      Since:
      1.7
    • getAs

      public static <E> E getAs(Map<?,?> map, Class<E> type, String key, E defVal)
      Type Parameters:
      E - the type
      Parameters:
      map - the map for getting
      type - the type instance
      key - the map-key
      defVal - the default value if failure of type check
      Returns:
      the non-null map.get(key) or defVal
    • getAsListNonNull

      public static <E> List<E> getAsListNonNull(Object list, Class<E> type)
      supporting method for setting JSON values
      Type Parameters:
      E - the element type
      Parameters:
      list - a list (nullable)
      type - the element type
      Returns:
      the list that satifies all elements are the type, or a new empty list.
      Since:
      1.7