Sauvegarde et lecture du fichier de synchronisation -> changement de structure pour une meilleur découpe des responsabilités
This commit is contained in:
parent
0161077cdd
commit
a185a3ecb7
6
app/src/main/java/lightcontainer/storage/FileReader.java
Normal file
6
app/src/main/java/lightcontainer/storage/FileReader.java
Normal file
@ -0,0 +1,6 @@
|
||||
package lightcontainer.storage;
|
||||
|
||||
public interface FileReader {
|
||||
|
||||
AppData readFile(String fileName);
|
||||
}
|
6
app/src/main/java/lightcontainer/storage/FileWriter.java
Normal file
6
app/src/main/java/lightcontainer/storage/FileWriter.java
Normal file
@ -0,0 +1,6 @@
|
||||
package lightcontainer.storage;
|
||||
|
||||
public interface FileWriter {
|
||||
|
||||
void writeToFile(String fileName, AppData appData);
|
||||
}
|
9
app/src/main/java/lightcontainer/storage/JsonReader.java
Normal file
9
app/src/main/java/lightcontainer/storage/JsonReader.java
Normal file
@ -0,0 +1,9 @@
|
||||
package lightcontainer.storage;
|
||||
|
||||
public class JsonReader implements FileReader {
|
||||
|
||||
@Override
|
||||
public AppData readFile(String fileName) {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
9
app/src/main/java/lightcontainer/storage/JsonWriter.java
Normal file
9
app/src/main/java/lightcontainer/storage/JsonWriter.java
Normal file
@ -0,0 +1,9 @@
|
||||
package lightcontainer.storage;
|
||||
|
||||
public class JsonWriter implements FileWriter {
|
||||
|
||||
@Override
|
||||
public void writeToFile(String fileName, AppData appData) {
|
||||
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user