Package com.google.gson

Examples of com.google.gson.JsonObject.addProperty()


    JsonObject weightConfig = typeConfig.get("weights").getAsJsonObject();

    for (Entry<String, JsonElement> entry : weightConfig.entrySet()) {
      String name = entry.getKey();
      if (name.equals(subtypeName)) {
        weightConfig.addProperty(name, 1);
      } else {
        weightConfig.addProperty(name, 0);
      }
    }
  }
View Full Code Here


    for (Entry<String, JsonElement> entry : weightConfig.entrySet()) {
      String name = entry.getKey();
      if (name.equals(subtypeName)) {
        weightConfig.addProperty(name, 1);
      } else {
        weightConfig.addProperty(name, 0);
      }
    }
  }
}
View Full Code Here

        String html = response.getResponseBody("UTF-8");

        JsonObject status = extractor.extractTweet(html);

        // save the requested id
        status.addProperty("requested_id", new Long(id));

        crawl.put(id, GSON.toJson(status));
        connections.decrementAndGet();

        return response;
View Full Code Here

            JsonObject expected = new JsonObject();
            expected.add("fieldName", new JsonPrimitive("has_boris"));
            expected.add("label", new JsonPrimitive("My Label"));
            expected.add("owner", new JsonPrimitive("test_data"));
            expected.addProperty("type", "boolean");
            expected.addProperty("trueLabel", "is_true");
            expected.addProperty("falseLabel", "is_false");

            Assert.assertEquals(expected, o);
        }
View Full Code Here

            JsonObject expected = new JsonObject();
            expected.add("fieldName", new JsonPrimitive("has_boris"));
            expected.add("label", new JsonPrimitive("My Label"));
            expected.add("owner", new JsonPrimitive("test_data"));
            expected.addProperty("type", "boolean");
            expected.addProperty("trueLabel", "is_true");
            expected.addProperty("falseLabel", "is_false");

            Assert.assertEquals(expected, o);
        }
    }
View Full Code Here

            expected.add("fieldName", new JsonPrimitive("has_boris"));
            expected.add("label", new JsonPrimitive("My Label"));
            expected.add("owner", new JsonPrimitive("test_data"));
            expected.addProperty("type", "boolean");
            expected.addProperty("trueLabel", "is_true");
            expected.addProperty("falseLabel", "is_false");

            Assert.assertEquals(expected, o);
        }
    }
View Full Code Here

            JsonObject expected = new JsonObject();
            expected.add("fieldName", new JsonPrimitive("_time"));
            expected.add("label", new JsonPrimitive("My Label"));
            expected.add("owner", new JsonPrimitive("BaseEvent"));
            expected.addProperty("type", "timestamp");
            expected.addProperty("period", "day");

            Assert.assertEquals(expected, o);
        }
    }
View Full Code Here

            JsonObject expected = new JsonObject();
            expected.add("fieldName", new JsonPrimitive("_time"));
            expected.add("label", new JsonPrimitive("My Label"));
            expected.add("owner", new JsonPrimitive("BaseEvent"));
            expected.addProperty("type", "timestamp");
            expected.addProperty("period", "day");

            Assert.assertEquals(expected, o);
        }
    }
View Full Code Here

        for (PivotRowSplit prs : pivotSpecification.getRowSplits()) {
            Assert.assertTrue(prs instanceof StringPivotRowSplit);
            JsonElement found = prs.toJson();

            JsonObject expected = new JsonObject();
            expected.addProperty("fieldName", "host");
            expected.addProperty("label", "My Label");
            expected.addProperty("owner", "BaseEvent");
            expected.addProperty("type", "string");

            Assert.assertEquals(expected, found);
View Full Code Here

            Assert.assertTrue(prs instanceof StringPivotRowSplit);
            JsonElement found = prs.toJson();

            JsonObject expected = new JsonObject();
            expected.addProperty("fieldName", "host");
            expected.addProperty("label", "My Label");
            expected.addProperty("owner", "BaseEvent");
            expected.addProperty("type", "string");

            Assert.assertEquals(expected, found);
        }
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.