Package com.goodow.realtime.json

Examples of com.goodow.realtime.json.JsonArray.push()


        for (OperationComponent<?> component : initializeComponents) {
          if (isCreateOp) {
            createComponents.push(component.toJson());
            isCreateOp = false;
          } else {
            components.push(component.toJson());
          }
        }
      }
    });
    components.forEach(new ListIterator<JsonElement>() {
View Full Code Here


    if (obj == null) {
      return null;
    }
    JsonArray array = Json.createArray();
    if (obj instanceof String) {
      array.push(VALUE_TYPE).push(obj);
    } else if (obj instanceof CollaborativeObjectImpl) {
      array.push(REFERENCE_TYPE).push(((CollaborativeObject) obj).id());
    } else if (obj instanceof JsonObject) {
      array.push(VALUE_TYPE).push(((JsonObject) obj).copy());
    } else if (obj instanceof JsonArray) {
View Full Code Here

    }
    JsonArray array = Json.createArray();
    if (obj instanceof String) {
      array.push(VALUE_TYPE).push(obj);
    } else if (obj instanceof CollaborativeObjectImpl) {
      array.push(REFERENCE_TYPE).push(((CollaborativeObject) obj).id());
    } else if (obj instanceof JsonObject) {
      array.push(VALUE_TYPE).push(((JsonObject) obj).copy());
    } else if (obj instanceof JsonArray) {
      array.push(VALUE_TYPE).push(((JsonArray) obj).copy());
    } else if (obj instanceof Number) {
View Full Code Here

    if (obj instanceof String) {
      array.push(VALUE_TYPE).push(obj);
    } else if (obj instanceof CollaborativeObjectImpl) {
      array.push(REFERENCE_TYPE).push(((CollaborativeObject) obj).id());
    } else if (obj instanceof JsonObject) {
      array.push(VALUE_TYPE).push(((JsonObject) obj).copy());
    } else if (obj instanceof JsonArray) {
      array.push(VALUE_TYPE).push(((JsonArray) obj).copy());
    } else if (obj instanceof Number) {
      array.push(VALUE_TYPE).push(((Number) obj).doubleValue());
    } else if (obj instanceof Boolean) {
View Full Code Here

    } else if (obj instanceof CollaborativeObjectImpl) {
      array.push(REFERENCE_TYPE).push(((CollaborativeObject) obj).id());
    } else if (obj instanceof JsonObject) {
      array.push(VALUE_TYPE).push(((JsonObject) obj).copy());
    } else if (obj instanceof JsonArray) {
      array.push(VALUE_TYPE).push(((JsonArray) obj).copy());
    } else if (obj instanceof Number) {
      array.push(VALUE_TYPE).push(((Number) obj).doubleValue());
    } else if (obj instanceof Boolean) {
      array.push(VALUE_TYPE).push(((Boolean) obj).booleanValue());
    } else {
View Full Code Here

    } else if (obj instanceof JsonObject) {
      array.push(VALUE_TYPE).push(((JsonObject) obj).copy());
    } else if (obj instanceof JsonArray) {
      array.push(VALUE_TYPE).push(((JsonArray) obj).copy());
    } else if (obj instanceof Number) {
      array.push(VALUE_TYPE).push(((Number) obj).doubleValue());
    } else if (obj instanceof Boolean) {
      array.push(VALUE_TYPE).push(((Boolean) obj).booleanValue());
    } else {
      throw new IllegalArgumentException("Invalid JSON type: " + obj.getClass().getName());
    }
View Full Code Here

    } else if (obj instanceof JsonArray) {
      array.push(VALUE_TYPE).push(((JsonArray) obj).copy());
    } else if (obj instanceof Number) {
      array.push(VALUE_TYPE).push(((Number) obj).doubleValue());
    } else if (obj instanceof Boolean) {
      array.push(VALUE_TYPE).push(((Boolean) obj).booleanValue());
    } else {
      throw new IllegalArgumentException("Invalid JSON type: " + obj.getClass().getName());
    }
    return array;
  }
View Full Code Here

  public static JsonArray serializeObjects(JsonArray values) {
    final JsonArray array = Json.createArray();
    values.forEach(new JsonArray.ListIterator<Object>() {
      @Override
      public void call(int index, Object obj) {
        array.push(serializeObject(obj));
      }
    });
    return array;
  }
}
View Full Code Here

    final JsonArray events = Json.createArray();
    IndexReference indexReference = str.registerReference(1, true);
    indexReference.onReferenceShifted(new Handler<ReferenceShiftedEvent>() {
      @Override
      public void handle(ReferenceShiftedEvent event) {
        events.push(event);
      }
    });
    indexReference.onObjectChanged(new Handler<ObjectChangedEvent>() {
      @Override
      public void handle(ObjectChangedEvent event) {
View Full Code Here

    final JsonArray events = Json.createArray();
    IndexReference indexReference = str.registerReference(1, false);
    indexReference.onReferenceShifted(new Handler<ReferenceShiftedEvent>() {
      @Override
      public void handle(ReferenceShiftedEvent event) {
        events.push(event);
      }
    });
    indexReference.onObjectChanged(new Handler<ObjectChangedEvent>() {
      @Override
      public void handle(ObjectChangedEvent event) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.