Class Savable<MappableObject extends Mappable>

java.lang.Object
main.utils.iocontrol.Savable<MappableObject>
Type Parameters:
MappableObject - a class that can be mapped to and from key-value pairs
Direct Known Subclasses:
Repository

public abstract class Savable<MappableObject extends Mappable> extends Object
An abstract class for managing objects that can be mapped to and from key-value pairs.
  • Constructor Details

    • Savable

      public Savable()
  • Method Details

    • getAll

      protected abstract List<MappableObject> getAll()
      Gets the list of mappable objects.
      Returns:
      the list of mappable objects
    • setAll

      protected abstract void setAll(List<Map<String,String>> listOfMappableObjects)
      Sets the list of mappable objects.
      Parameters:
      listOfMappableObjects - the list of mappable objects to set
    • save

      protected void save(String FILE_PATH)
      Saves the list of mappable objects to a file.
      Parameters:
      FILE_PATH - the path of the file to save to
      Throws:
      RuntimeException - if the data could not be saved to the file
    • load

      protected void load(String FILE_PATH)
      Loads the list of mappable objects from a file.
      Parameters:
      FILE_PATH - the path of the file to load from
      Throws:
      RuntimeException - if the data could not be loaded from the file