google app engine - Store java.util.List into GAE Datastore -


this idea of storing json , json-like documents "natively" gae datastore:

protected void createentity(key parent, map obj){        try {         entity e = new entity(                 parent == null ? createkey(_kind, (string) obj.get(object_id)) : parent);           iterator = obj.keyset().iterator();         while (it.hasnext()){             string key = (string) it.next();             if (obj.get(key) == null){                 e.setproperty(key, null);             } else if (obj.get(key) instanceof string) {                 setproperty(e, key, obj.get(key));             } else if(obj.get(key) instanceof number) {                 setproperty(e, key, obj.get(key));             } else if(obj.get(key) instanceof boolean) {                 setproperty(e, key, obj.get(key));             } else if(obj.get(key) instanceof list) {                 // problem area, right way store list?                  // list may contain jsonobject too!             } else if(obj.get(key) instanceof map){                                     // update: ooops, cause stackoverflow error!                                     key pkey = createkey(e.getkey(), _kind, (string) obj.get(key));                                      e.setproperty(key, pkey.tostring()); // not sure?                 createentity(pkey, obj);             }         }            _ds.put(e);     } catch (concurrentmodificationexception e){      } catch (exception e) {         // todo: handle exception     } } 

the approach recursive put, gae supported non-collection properties stored directly entity's property. maps new entity created parent key having current entity key, , forth.

the basis of supported types of json interface this: http://code.google.com/p/json-simple/

the problem have i'm not sure how deal java.util.list, , how store maybe in manner map.

any suggestion on how achieve this?


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -