Example #1
0
 @Override
 public Object visit(ListProperty property, Object arg) throws PropertyException {
   Object value = null;
   if (property.isContainer()) {
     value = new JSONArray();
   } else {
     value = property.getValue();
   }
   if (property.getParent() instanceof BlobProperty) {
     log.warn(
         "Property '"
             + property.getName()
             + "' ignored during serialization. Blob and blob related properties are not written to json object.");
   } else if (property.getParent().isList()) {
     ((JSONArray) arg).add(value);
   } else {
     try {
       ((JSONObject) arg).put(property.getField().getName().getPrefixedName(), value);
     } catch (JSONException e) {
       throw new PropertyException("Failed to put value", e);
     }
   }
   return value;
 }