Last active
March 14, 2019 07:37
Revisions
-
jamiechapman revised this gist
Apr 12, 2013 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,6 @@ // By Jamie Chapman, @chappers57 // License: open, do as you wish, just don't blame me if stuff breaks ;-) public class ParseProxyObject implements Serializable { private static final long serialVersionUID = 1L; -
jamiechapman revised this gist
Apr 12, 2013 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -23,6 +23,8 @@ public ParseProxyObject(ParseObject object) { } else if(classType == ParseUser.class) { ParseProxyObject parseUserObject = new ParseProxyObject((ParseObject)object.get(key)); values.put(key, parseUserObject); } else { // You might want to add more conditions here, for embedded ParseObject, ParseFile, etc. } } } -
jamiechapman revised this gist
Apr 12, 2013 . 1 changed file with 12 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,3 @@ public class ParseProxyObject implements Serializable { private static final long serialVersionUID = 1L; @@ -27,6 +20,9 @@ public ParseProxyObject(ParseObject object) { if(classType == byte[].class || classType == String.class || classType == Integer.class || classType == Boolean.class) { values.put(key, object.get(key)); } else if(classType == ParseUser.class) { ParseProxyObject parseUserObject = new ParseProxyObject((ParseObject)object.get(key)); values.put(key, parseUserObject); } } } @@ -63,7 +59,15 @@ public byte[] getBytes(String key) { } } public ParseProxyObject getParseUser(String key) { if(has(key)) { return (ParseProxyObject) values.get(key); } else { return null; } } public Boolean has(String key) { return values.containsKey(key); } } -
jamiechapman revised this gist
Apr 12, 2013 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,8 +8,7 @@ public class ParseProxyObject implements Serializable { private static final long serialVersionUID = 1L; private HashMap<String, Object> values = new HashMap<String, Object>(); public HashMap<String, Object> getValues() { return values; -
jamiechapman revised this gist
Apr 12, 2013 . 1 changed file with 10 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import com.parse.ParseObject; public class ParseProxyObject implements Serializable { private static final long serialVersionUID = 1L; HashMap<String, Object> values = new HashMap<String, Object>(); @@ -33,34 +33,38 @@ public ParseProxyObject(ParseObject object) { } public String getString(String key) { if(has(key)) { return (String) values.get(key); } else { return ""; } } public int getInt(String key) { if(has(key)) { return (Integer)values.get(key); } else { return 0; } } public Boolean getBoolean(String key) { if(has(key)) { return (Boolean)values.get(key); } else { return false; } } public byte[] getBytes(String key) { if(has(key)) { return (byte[])values.get(key); } else { return new byte[0]; } } public Boolean has(String key) { return values.containsKey(key); } } -
jamiechapman created this gist
Apr 12, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,66 @@ package com.<YOUR_PACKAGE>; import java.io.Serializable; import java.util.HashMap; import com.parse.ParseObject; public class ParseProxyObject implements Serializable { private static final long serialVersionUID = 1L; HashMap<String, Object> values = new HashMap<String, Object>(); public HashMap<String, Object> getValues() { return values; } public void setValues(HashMap<String, Object> values) { this.values = values; } public ParseProxyObject(ParseObject object) { // Loop the keys in the ParseObject for(String key : object.keySet()) { @SuppressWarnings("rawtypes") Class classType = object.get(key).getClass(); if(classType == byte[].class || classType == String.class || classType == Integer.class || classType == Boolean.class) { values.put(key, object.get(key)); } } } public String getString(String key) { if(values.containsKey(key)) { return (String) values.get(key); } else { return ""; } } public int getInt(String key) { if(values.containsKey(key)) { return (Integer)values.get(key); } else { return 0; } } public Boolean getBoolean(String key) { if(values.containsKey(key)) { return (Boolean)values.get(key); } else { return false; } } public byte[] getBytes(String key) { if(values.containsKey(key)) { return (byte[])values.get(key); } else { return new byte[0]; } } }