Skip to content

//Ankea/fi.jyu.ohj2.sourander.ankea.repository/DeckRepository

DeckRepository

[JVM]\ open class DeckRepository

Persistence layer that loads and saves all decks to a JSON file on disk. By default the data is stored in ~/.ankea/database.json. A custom java.nio.file.Path can be supplied via the secondary constructor, which is useful for testing purposes. Because Deck and Flashcard use JavaFX Property types, they are mapped through package-private DTOs (DeckData / FlashcardData) rather than being serialised directly.

Constructors

DeckRepository [JVM]
constructor()
Creates a repository that persists data at the default location (~/.ankea/database.json).
constructor(filePath: Path)
Creates a repository that persists data at a custom location.

Functions

Name Summary
loadAll [JVM]
open fun loadAll(): List<Deck>
Deserialises all decks from the JSON file.
saveAll [JVM]
open fun saveAll(decks: List<Deck>)
Serialises the given deck list to the JSON file.