diff --git a/app/src/main/java/lightcontainer/storage/Adapter.java b/app/src/main/java/lightcontainer/storage/Adapter.java index 30843ab..29d5dc3 100644 --- a/app/src/main/java/lightcontainer/storage/Adapter.java +++ b/app/src/main/java/lightcontainer/storage/Adapter.java @@ -1,8 +1,7 @@ package lightcontainer.storage; public interface Adapter { - - + String toString(); AppData fromString(String appDataString); diff --git a/app/src/main/java/lightcontainer/storage/File.java b/app/src/main/java/lightcontainer/storage/File.java index dcee5cc..e7d5d5f 100644 --- a/app/src/main/java/lightcontainer/storage/File.java +++ b/app/src/main/java/lightcontainer/storage/File.java @@ -3,6 +3,9 @@ package lightcontainer.storage; import java.util.Iterator; import java.util.Set; +/** + * File represents all information related to a file + */ public class File { private final String name; diff --git a/app/src/main/java/lightcontainer/storage/JsonAdapter.java b/app/src/main/java/lightcontainer/storage/JsonAdapter.java index 831b0f1..aaecc55 100644 --- a/app/src/main/java/lightcontainer/storage/JsonAdapter.java +++ b/app/src/main/java/lightcontainer/storage/JsonAdapter.java @@ -4,6 +4,9 @@ import com.google.gson.*; import java.util.*; +/** + * Specific implementation of Adapter that converts AppData to Json and vice-versa + */ public class JsonAdapter implements Adapter { private AppData appData; @@ -12,6 +15,10 @@ public class JsonAdapter implements Adapter { this.appData = appData; } + /** + * + * @return A Json String containing AppData properties + */ @Override public String toString() { return addData(appData); @@ -69,6 +76,11 @@ public class JsonAdapter implements Adapter { } } + /** + * + * @param appDataString The Json String to convert + * @return An AppData instance + */ @Override public AppData fromString(String appDataString) { try { diff --git a/app/src/main/java/lightcontainer/storage/Repository.java b/app/src/main/java/lightcontainer/storage/Repository.java index 3ea0ac6..1f085a6 100644 --- a/app/src/main/java/lightcontainer/storage/Repository.java +++ b/app/src/main/java/lightcontainer/storage/Repository.java @@ -10,6 +10,10 @@ import java.nio.file.StandardOpenOption; public class Repository { + /** + * @param filePath The path where the file must be saved + * @param adapter The service that converts Objects to Strings + */ static void save(String filePath, Adapter adapter) { if (filePath != null) { String jsonAppData = adapter.toString(); @@ -22,6 +26,11 @@ public class Repository { } } + /** + * @param filePath The path where the file is stored + * @param adapter The service that converts Strings to objects + * @return + */ static AppData load(String filePath, Adapter adapter) { String jsonString = readFile(filePath); return adapter.fromString(jsonString); diff --git a/app/src/main/java/lightcontainer/storage/User.java b/app/src/main/java/lightcontainer/storage/User.java index 9ba83f2..47a65f9 100644 --- a/app/src/main/java/lightcontainer/storage/User.java +++ b/app/src/main/java/lightcontainer/storage/User.java @@ -1,9 +1,7 @@ package lightcontainer.storage; -import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import java.util.Set; /** * User represents a user of the system.