Interface IJsonConfig<T>

Type Parameters:
T - the config class

@NonExtendable public interface IJsonConfig<T>
An Interface for easy (de)serialization for config classes
  • Method Details

    • of

      static <T> IJsonConfig.Builder0<T> of(Class<T> clazz)
      Creates a builder for concrete config type.
    • of

      static <T> IJsonConfig.Builder0<T> of(com.google.gson.reflect.TypeToken<T> type)
      Creates a builder for generic config type.

      Note: the object factory must be specified.

    • get

      T get()
      Get current value
    • save

      void save()
      Save value to file
    • write

      void write(T t, boolean invalidate)
      Write value to file
    • invalidate

      void invalidate()
      Invalidate current value and force re-read file on next get()
    • isFileExists

      boolean isFileExists()
      Returns:
      whether the config file exists.
    • getPath

      Path getPath()
      Returns:
      the path to the config file.
    • backup

      void backup(@Nullable @Nullable String cause)
      Backup and invalidate current value and force re-read file on next get(). The backup will have a time suffix to it's file extension.
    • backup

      default void backup()
      See Also: