Interface TypeConverter<T>

Type Parameters:
T - The type
All Known Subinterfaces:
StringConverter<T>

public interface TypeConverter<T>
An interface which converts data in config for a given type
  • Method Summary

    Modifier and Type
    Method
    Description
    loadFrom(DataHolder section, String path, T currentValue)
    Attemps to load the object from config
    void
    saveTo(T t, DataHolder section, String path)
    Attemps to save the object to config
    default void
    saveTo(T t, DataHolder section, String path, boolean overwrite)
    Attemps to save the object to config
  • Method Details

    • loadFrom

      T loadFrom(DataHolder section, String path, T currentValue)
      Attemps to load the object from config
      Parameters:
      section - The ConfigurationSection to load from
      path - The path to the data in the ConfigurationSection
      currentValue - The current value, used for collections and maps
      Returns:
      The loaded object
    • saveTo

      void saveTo(T t, DataHolder section, String path)
      Attemps to save the object to config
      Parameters:
      t - The object to save
      section - The ConfigurationSection to save to
      path - The path to the data that should be saved in the ConfigurationSection
    • saveTo

      default void saveTo(T t, DataHolder section, String path, boolean overwrite)
      Attemps to save the object to config
      Parameters:
      t - The object to save
      section - The ConfigurationSection to save to
      path - The path to the data that should be saved in the ConfigurationSection
      overwrite - Whether to overwrite existing data