Package main.utils.iocontrol
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
An abstract class for managing objects that can be mapped to and from key-value pairs.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract List<MappableObject>
getAll()
Gets the list of mappable objects.protected void
Loads the list of mappable objects from a file.protected void
Saves the list of mappable objects to a file.protected abstract void
Sets the list of mappable objects.
-
Constructor Details
-
Savable
public Savable()
-
-
Method Details
-
getAll
Gets the list of mappable objects.- Returns:
- the list of mappable objects
-
setAll
Sets the list of mappable objects.- Parameters:
listOfMappableObjects
- the list of mappable objects to set
-
save
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
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
-