Example #1
0
 @Override
 protected void modelToJson(
     org.slim3.datastore.json.JsonWriter writer,
     java.lang.Object model,
     int maxDepth,
     int currentDepth) {
   tutorial.global.cool.model.BaseFormObject m = (tutorial.global.cool.model.BaseFormObject) model;
   writer.beginObject();
   org.slim3.datastore.json.Default encoder0 = new org.slim3.datastore.json.Default();
   if (m.getEmail() != null) {
     writer.setNextPropertyName("email");
     encoder0.encode(writer, m.getEmail());
   }
   if (m.getInsertDate() != null) {
     writer.setNextPropertyName("insertDate");
     encoder0.encode(writer, m.getInsertDate());
   }
   if (m.getKey() != null) {
     writer.setNextPropertyName("key");
     encoder0.encode(writer, m.getKey());
   }
   if (m.getUpdateDate() != null) {
     writer.setNextPropertyName("updateDate");
     encoder0.encode(writer, m.getUpdateDate());
   }
   if (m.getUserId() != null) {
     writer.setNextPropertyName("userId");
     encoder0.encode(writer, m.getUserId());
   }
   if (m.getVersion() != null) {
     writer.setNextPropertyName("version");
     encoder0.encode(writer, m.getVersion());
   }
   writer.endObject();
 }
Example #2
0
 @Override
 public com.google.appengine.api.datastore.Entity modelToEntity(java.lang.Object model) {
   tutorial.global.cool.model.BaseFormObject m = (tutorial.global.cool.model.BaseFormObject) model;
   com.google.appengine.api.datastore.Entity entity = null;
   if (m.getKey() != null) {
     entity = new com.google.appengine.api.datastore.Entity(m.getKey());
   } else {
     entity = new com.google.appengine.api.datastore.Entity(kind);
   }
   entity.setProperty("email", m.getEmail());
   entity.setProperty("insertDate", m.getInsertDate());
   entity.setProperty("updateDate", m.getUpdateDate());
   entity.setProperty("userId", m.getUserId());
   entity.setProperty("version", m.getVersion());
   entity.setProperty("slim3.schemaVersion", 1);
   return entity;
 }
Example #3
0
 @Override
 protected tutorial.global.cool.model.BaseFormObject jsonToModel(
     org.slim3.datastore.json.JsonRootReader rootReader, int maxDepth, int currentDepth) {
   tutorial.global.cool.model.BaseFormObject m = new tutorial.global.cool.model.BaseFormObject();
   org.slim3.datastore.json.JsonReader reader = null;
   org.slim3.datastore.json.Default decoder0 = new org.slim3.datastore.json.Default();
   reader = rootReader.newObjectReader("email");
   m.setEmail(decoder0.decode(reader, m.getEmail()));
   reader = rootReader.newObjectReader("insertDate");
   m.setInsertDate(decoder0.decode(reader, m.getInsertDate()));
   reader = rootReader.newObjectReader("key");
   m.setKey(decoder0.decode(reader, m.getKey()));
   reader = rootReader.newObjectReader("updateDate");
   m.setUpdateDate(decoder0.decode(reader, m.getUpdateDate()));
   reader = rootReader.newObjectReader("userId");
   m.setUserId(decoder0.decode(reader, m.getUserId()));
   reader = rootReader.newObjectReader("version");
   m.setVersion(decoder0.decode(reader, m.getVersion()));
   return m;
 }