From a185a3ecb77fe04360ab7f2635080743c9f0a764 Mon Sep 17 00:00:00 2001 From: Maximilien LEDOUX Date: Sat, 5 Mar 2022 17:48:56 +0100 Subject: [PATCH] =?UTF-8?q?Sauvegarde=20et=20lecture=20du=20fichier=20de?= =?UTF-8?q?=20synchronisation=20->=20changement=20de=20structure=20pour=20?= =?UTF-8?q?une=20meilleur=20d=C3=A9coupe=20des=20responsabilit=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/lightcontainer/storage/FileReader.java | 6 ++++++ app/src/main/java/lightcontainer/storage/FileWriter.java | 6 ++++++ app/src/main/java/lightcontainer/storage/JsonReader.java | 9 +++++++++ .../main/java/lightcontainer/storage/JsonRepository.java | 6 ++++-- app/src/main/java/lightcontainer/storage/JsonWriter.java | 9 +++++++++ app/src/main/java/lightcontainer/storage/Repository.java | 4 ++-- 6 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 app/src/main/java/lightcontainer/storage/FileReader.java create mode 100644 app/src/main/java/lightcontainer/storage/FileWriter.java create mode 100644 app/src/main/java/lightcontainer/storage/JsonReader.java create mode 100644 app/src/main/java/lightcontainer/storage/JsonWriter.java diff --git a/app/src/main/java/lightcontainer/storage/FileReader.java b/app/src/main/java/lightcontainer/storage/FileReader.java new file mode 100644 index 0000000..4e79a0b --- /dev/null +++ b/app/src/main/java/lightcontainer/storage/FileReader.java @@ -0,0 +1,6 @@ +package lightcontainer.storage; + +public interface FileReader { + + AppData readFile(String fileName); +} diff --git a/app/src/main/java/lightcontainer/storage/FileWriter.java b/app/src/main/java/lightcontainer/storage/FileWriter.java new file mode 100644 index 0000000..3cef3aa --- /dev/null +++ b/app/src/main/java/lightcontainer/storage/FileWriter.java @@ -0,0 +1,6 @@ +package lightcontainer.storage; + +public interface FileWriter { + + void writeToFile(String fileName, AppData appData); +} diff --git a/app/src/main/java/lightcontainer/storage/JsonReader.java b/app/src/main/java/lightcontainer/storage/JsonReader.java new file mode 100644 index 0000000..0b67603 --- /dev/null +++ b/app/src/main/java/lightcontainer/storage/JsonReader.java @@ -0,0 +1,9 @@ +package lightcontainer.storage; + +public class JsonReader implements FileReader { + + @Override + public AppData readFile(String fileName) { + return null; + } +} diff --git a/app/src/main/java/lightcontainer/storage/JsonRepository.java b/app/src/main/java/lightcontainer/storage/JsonRepository.java index a002404..c2c693d 100644 --- a/app/src/main/java/lightcontainer/storage/JsonRepository.java +++ b/app/src/main/java/lightcontainer/storage/JsonRepository.java @@ -4,12 +4,14 @@ public class JsonRepository implements Repository { @Override - public void save(String fileName, AppData data) { + public void save(FileWriter fileWriter) { } @Override - public AppData load(String fileName) { + public AppData load(FileReader fileReader) { return null; } + + } diff --git a/app/src/main/java/lightcontainer/storage/JsonWriter.java b/app/src/main/java/lightcontainer/storage/JsonWriter.java new file mode 100644 index 0000000..56fceb9 --- /dev/null +++ b/app/src/main/java/lightcontainer/storage/JsonWriter.java @@ -0,0 +1,9 @@ +package lightcontainer.storage; + +public class JsonWriter implements FileWriter { + + @Override + public void writeToFile(String fileName, AppData appData) { + + } +} diff --git a/app/src/main/java/lightcontainer/storage/Repository.java b/app/src/main/java/lightcontainer/storage/Repository.java index 79f19fd..b688fc7 100644 --- a/app/src/main/java/lightcontainer/storage/Repository.java +++ b/app/src/main/java/lightcontainer/storage/Repository.java @@ -2,7 +2,7 @@ package lightcontainer.storage; public interface Repository { - void save(String fileName, AppData data); + void save(FileWriter fileWriter); - AppData load(String fileName); + AppData load(FileReader fileReader); }