Package com.google.gwt.json.client

Examples of com.google.gwt.json.client.JSONObject.containsKey()


            ApplicationConnection connection) {
        TranslatedURLReference reference = GWT
                .create(TranslatedURLReference.class);
        reference.setConnection(connection);
        JSONObject json = (JSONObject) jsonValue;
        if (json.containsKey(URL_FIELD)) {
            JSONValue jsonURL = json.get(URL_FIELD);
            String URL = (String) JsonDecoder.decodeValue(
                    new Type(String.class.getName(), null), jsonURL, null,
                    connection);
            reference.setURL(URL);
View Full Code Here


  }
  private TaskBuilder[] parseTasks(JSONObject jsonStep) {
    JSONObject jsonTasks=jsonStep.get(TaskBuilder.TASKS_KEY).isObject();
    TaskBuilder[] builders=new TaskBuilder[jsonTasks.size()];
    int i=0;
    if(jsonTasks.containsKey(TaskBuilder.ButtonBuilder.BUTTON_KEY)){
      builders[i++]=new TaskBuilder.ButtonBuilder();
    }
   
    if(jsonTasks.containsKey(TaskBuilder.BlueMarkBuilder.MARK_KEY)){
      JSONObject jsonMark=jsonTasks.get(TaskBuilder.BlueMarkBuilder.MARK_KEY).isObject();
View Full Code Here

    int i=0;
    if(jsonTasks.containsKey(TaskBuilder.ButtonBuilder.BUTTON_KEY)){
      builders[i++]=new TaskBuilder.ButtonBuilder();
    }
   
    if(jsonTasks.containsKey(TaskBuilder.BlueMarkBuilder.MARK_KEY)){
      JSONObject jsonMark=jsonTasks.get(TaskBuilder.BlueMarkBuilder.MARK_KEY).isObject();
      builders[i++]=new TaskBuilder.BlueMarkBuilder((int) jsonMark.get(TaskBuilder.BlueMarkBuilder.INDEX_KEY).isNumber().doubleValue(),
                              jsonMark.get(TaskBuilder.BlueMarkBuilder.X_KEY).isNumber().doubleValue(),
                              jsonMark.get(TaskBuilder.BlueMarkBuilder.Y_KEY).isNumber().doubleValue(),
                              jsonMark.get(TaskBuilder.BlueMarkBuilder.ANGLE_KEY).isNumber().doubleValue());
View Full Code Here

    JSONObject fileCoverage =
        coverage.get("com/google/gwt/dev/js/client/CoverageTestModule.java").isObject();
    assertNotNull(fileCoverage);
    for (Map.Entry<String, Double> lineCoverage : EXPECTED_COVERAGE.entrySet()) {
      assertTrue(fileCoverage.containsKey(lineCoverage.getKey()));
      JSONNumber value = fileCoverage.get(lineCoverage.getKey()).isNumber();
      assertNotNull(value);
      assertEquals(lineCoverage.getValue(), value.doubleValue(), 0.0001);
    }
  }
View Full Code Here

          JSONObject argObject = argsArray.get(i).isObject();
          //for backwards compatability, first try to get key and value from object
          //can remove this in the future
          String key = null;
          String value = null;
          if (argObject.containsKey("key") && argObject.containsKey("value")) {
            key = argObject.get("key").isString().stringValue();
            value = argObject.get("value").isString().stringValue();
          } else {
            Set<String> keySet = argObject.keySet();
            for (String arrayKey: keySet) {
View Full Code Here

          JSONObject argObject = argsArray.get(i).isObject();
          //for backwards compatability, first try to get key and value from object
          //can remove this in the future
          String key = null;
          String value = null;
          if (argObject.containsKey("key") && argObject.containsKey("value")) {
            key = argObject.get("key").isString().stringValue();
            value = argObject.get("value").isString().stringValue();
          } else {
            Set<String> keySet = argObject.keySet();
            for (String arrayKey: keySet) {
View Full Code Here

            socketClient = new WebSocketClient(new WebSocketCallback() {

                @Override
                public void message(final String message) {
                    final JSONObject data = JSONParser.parseStrict(message).isObject();
                    if (data.containsKey(Dictionnary.APPLICATION.PING)) return;

                    uiService.update(data);
                }

                @Override
View Full Code Here

      JSONObject item = items.get(i).isObject();
      JSONValue js = item.get("js");
      if(js != null)
        ((VkMenuBarHorizontalEngine)VkStateHelper.getInstance().getWidgetEngineMapping().getEngineMap().get(((IVkWidget)tree).getWidgetName()))
          .addMenuItem(tree, item.get("html").isString().stringValue(), item.get("js").isString().stringValue());
      else if(item.containsKey("child"))
      {
        JSONObject childObj = item.get("child").isObject();
        JSONString widgetName = childObj.get("widgetName").isString();
        Widget widget = VkStateHelper.getInstance().getEngine().getWidget(widgetName.stringValue());
        VkStateHelper.getInstance().getEngine().addWidget(widget, ((IVkPanel)tree));
View Full Code Here

      // Arrange
      String json = "{\"string\": \"json string\", \"int\": 3.0}";
      JSONObject o = JSONParser.parseStrict(json).isObject();

      // Test
      assertThat(o.containsKey("string")).isTrue();
      assertThat(o.containsKey("int")).isTrue();
      assertThat(o.containsKey("does-not-exist")).isFalse();

   }
View Full Code Here

      String json = "{\"string\": \"json string\", \"int\": 3.0}";
      JSONObject o = JSONParser.parseStrict(json).isObject();

      // Test
      assertThat(o.containsKey("string")).isTrue();
      assertThat(o.containsKey("int")).isTrue();
      assertThat(o.containsKey("does-not-exist")).isFalse();

   }

   @Test
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.