Class AbstractSave

java.lang.Object
com.viaversion.viafabricplus.save.AbstractSave
Direct Known Subclasses:
AccountsSave, SettingsSave

public abstract class AbstractSave extends Object
This class can be used to save data to a file.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.google.gson.Gson
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    void
    This method should be called when the file should be initialized.
    void
     
    abstract void
    read(com.google.gson.JsonObject object)
     
    void
    This method should be called when the file should be saved.
    abstract void
    write(com.google.gson.JsonObject object)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • GSON

      public static final com.google.gson.Gson GSON
  • Constructor Details

    • AbstractSave

      public AbstractSave(String name)
      Parameters:
      name - The name of the file.
  • Method Details

    • init

      public void init()
      This method should be called when the file should be initialized. It will read the file and call the read(JsonObject) method.
    • save

      public void save()
      This method should be called when the file should be saved.
    • write

      public abstract void write(com.google.gson.JsonObject object)
    • read

      public abstract void read(com.google.gson.JsonObject object)
    • postInit

      public void postInit()
    • getPath

      public Path getPath()