Package core
Class StudentDataPersistentStorageService
java.lang.Object
core.StudentDataPersistentStorageService
- All Implemented Interfaces:
IStudentDataPersistentStorageService
public class StudentDataPersistentStorageService
extends Object
implements IStudentDataPersistentStorageService
Klasa przechowywania danych studenta w systemie plików.
-
Constructor Summary
ConstructorsConstructorDescriptionStudentDataPersistentStorageService
(String filename, IFilesystemService filesystemService) Konstruktor. -
Method Summary
Modifier and TypeMethodDescriptionload()
Metoda ładująca dane studentów z pliku wyszczególnionego w konstruktorze.void
save
(Collection<StudentData> studentData) Metoda zapisująca dane do pliku wyszczególnionego w konstruktorze.
-
Constructor Details
-
StudentDataPersistentStorageService
Konstruktor. Należy podać nazwę pliku json, do którego będą zapisywane dane oraz serwis systemu plików.- Parameters:
filename
- Nazwa pliku json.filesystemService
- Serwis systemu plików.
-
-
Method Details
-
save
Metoda zapisująca dane do pliku wyszczególnionego w konstruktorze.- Specified by:
save
in interfaceIStudentDataPersistentStorageService
- Parameters:
studentData
- Dane studentów w postaci kolekcji.- Throws:
Exception
- Wyjątek w przypadku błędu zapisu danych.
-
load
Metoda ładująca dane studentów z pliku wyszczególnionego w konstruktorze.- Specified by:
load
in interfaceIStudentDataPersistentStorageService
- Returns:
- Lista danych studentów.
- Throws:
Exception
- Wyjątek w przypadku błędu odczytu danych.
-