Beispiel #1
0
  private JSONObject serializeObject(final SerializableEntity object) {
    if (null == object) {
      return new JSONObject();
    }

    final JsonSerializer serializer =
        new JsonSerializer(this.getContext(), null != this.propertyOrderArray);
    object.serialize(serializer);
    return serializer.getObject();
  }
Beispiel #2
0
 /**
  * Helper function that serializes a SerializableEntity to a JSON object.
  *
  * @param entity The entity to serialize.
  * @return The resulting JSON object.
  */
 public static JSONObject serializeToJson(final SerializableEntity entity) {
   final JsonSerializer serializer = new JsonSerializer();
   entity.serialize(serializer);
   return serializer.getObject();
 }