diff options
author | Marko Živković <[email protected]> | 2015-03-04 01:39:52 +0000 |
---|---|---|
committer | Marko Živković <[email protected]> | 2015-03-04 01:39:52 +0000 |
commit | 094911feca43980c4f81582dfd8cdc0ad8faed71 (patch) | |
tree | aa1162f0a516600af8664d0a3028a3ec73e1aa0d | |
parent | 767afa7cbc7e46c290fba256ebc461b31f1849fe (diff) |
Add UserConfigJSONSerializer (not yet implemented)
git-svn-id: https://svn.code.sf.net/p/xlogo4schools/svn/trunk@34 3b0d7934-f7ef-4143-9606-b51f2e2281fd
-rw-r--r-- | logo/src/xlogo/storage/user/UserConfigJSONSerializer.java | 42 |
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;
+ }
+
+}
|