summaryrefslogtreecommitdiffstats
path: root/logo
diff options
context:
space:
mode:
Diffstat (limited to 'logo')
-rw-r--r--logo/src/xlogo/storage/user/UserConfigJSONSerializer.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/logo/src/xlogo/storage/user/UserConfigJSONSerializer.java b/logo/src/xlogo/storage/user/UserConfigJSONSerializer.java
new file mode 100644
index 0000000..6cf8e30
--- /dev/null
+++ b/logo/src/xlogo/storage/user/UserConfigJSONSerializer.java
@@ -0,0 +1,42 @@
+package xlogo.storage.user;
+
+import java.io.File;
+
+import org.json.JSONObject;
+
+import xlogo.storage.JSONSerializer;
+import xlogo.storage.StorableObject;
+import xlogo.storage.user.UserConfig.UserProperty;
+
+public class UserConfigJSONSerializer extends JSONSerializer<UserConfig> {
+
+ public static StorableObject<UserConfig, UserProperty> createOrLoad(File userDir){
+ return createOrLoad(userDir, false);
+ }
+
+ public static StorableObject<UserConfig, UserProperty> createOrLoad(File userDir, boolean isDeferred){
+ StorableObject<UserConfig, UserProperty> userConfig = new StorableObject<UserConfig,UserProperty>(UserConfig.class, userDir);
+ try {
+ userConfig = userConfig.createOrLoad();
+ userConfig.get().setDirectory(userDir);
+ }
+ catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return userConfig;
+ }
+
+ @Override
+ public JSONObject serialize2JSON(UserConfig object) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public UserConfig deserialize(JSONObject json) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}