Examples of JsonPrimitive


Examples of com.google.gson.JsonPrimitive

            Assert.assertTrue(obj instanceof JsonObject);
            JsonObject o = (JsonObject)obj;

            Assert.assertTrue(o.has("fieldName"));
            Assert.assertEquals(new JsonPrimitive("epsilon"), o.get("fieldName"));

            Assert.assertTrue(o.has("owner"));
            Assert.assertEquals(new JsonPrimitive("test_data"), o.get("owner"));

            Assert.assertTrue(o.has("type"));
            Assert.assertEquals(new JsonPrimitive("number"), o.get("type"));

            Assert.assertTrue(o.has("attributeName"));
            Assert.assertEquals(new JsonPrimitive("host"), o.get("attributeName"));

            Assert.assertTrue(o.has("attributeOwner"));
            Assert.assertEquals(new JsonPrimitive("BaseEvent"), o.get("attributeOwner"));

            Assert.assertTrue(o.has("limitType"));
            Assert.assertEquals(new JsonPrimitive("lowest"), o.get("limitType"));

            Assert.assertTrue(o.has("limitAmount"));
            Assert.assertEquals(new JsonPrimitive(500), o.get("limitAmount"));

            Assert.assertTrue(o.has("statsFn"));
            Assert.assertEquals(new JsonPrimitive("average"), o.get("statsFn"));
        }
    }
View Full Code Here

Examples of com.google.gson.JsonPrimitive

            Assert.assertTrue(obj instanceof JsonObject);
            JsonObject o = (JsonObject)obj;

            Assert.assertTrue(o.has("fieldName"));
            Assert.assertEquals(new JsonPrimitive("epsilon"), o.get("fieldName"));

            Assert.assertTrue(o.has("owner"));
            Assert.assertEquals(new JsonPrimitive("test_data"), o.get("owner"));

            Assert.assertTrue(o.has("type"));
            Assert.assertEquals(new JsonPrimitive("number"), o.get("type"));

            Assert.assertTrue(o.has("label"));
            Assert.assertEquals(new JsonPrimitive("My Label"), o.get("label"));

            Assert.assertTrue(o.has("display"));
            Assert.assertEquals(new JsonPrimitive("all"), o.get("display"));
        }
    }
View Full Code Here

Examples of com.google.gson.JsonPrimitive

    }

    public static class DateTimeSerializer implements JsonSerializer<DateTime> {
        @Override
        public JsonElement serialize(DateTime src, Type typeOfSrc, JsonSerializationContext context) {
            return new JsonPrimitive(SSTimeUtil.dateTimeToIsoNoMillis(src));
        }
View Full Code Here

Examples of com.google.gson.JsonPrimitive

    @Override
    public JsonElement serialize (Date value, Type type, JsonSerializationContext context) {
        synchronized (enUsFormat) {
            String ret = this.iso8601Format.format(value);
            return new JsonPrimitive(ret.substring(0, 22) + ":" + ret.substring(22));
        }
    }
View Full Code Here

Examples of com.google.gson.JsonPrimitive

    public JsonElement serialize (PropertyMap src, Type typeOfSrc, JsonSerializationContext context) {
        JsonObject out = new JsonObject();
        for (String key : src.keySet()) {
            JsonArray jsa = new JsonArray();
            for (Property p : src.get(key)) {
                jsa.add(new JsonPrimitive(p.getValue()));
            }
            out.add(key, jsa);
        }
        return out;
    }
View Full Code Here

Examples of com.google.gson.JsonPrimitive

        for (Map.Entry<ExecutionPhase, Set<ExecutionScript>> entry : flowScript.getScripts().entrySet()) {
            ExecutionPhase phase = entry.getKey();
            if (entry.getValue().isEmpty() == false
                    || phase == ExecutionPhase.SETUP
                    || phase == ExecutionPhase.CLEANUP) {
                phases.add(new JsonPrimitive(phase.getSymbol()));
            }
        }
        JsonObject jobflow = new JsonObject();
        jobflow.addProperty("id", flowScript.getId());
        jobflow.add("blockers", toJsonArray(flowScript.getBlockerIds()));
View Full Code Here

Examples of com.google.gson.JsonPrimitive

    private static JsonArray toJsonArray(Collection<String> values) {
        assert values != null;
        JsonArray array = new JsonArray();
        for (String value : values) {
            array.add(new JsonPrimitive(value));
        }
        return array;
    }
View Full Code Here

Examples of com.google.gson.JsonPrimitive

        public JobStatus.Kind deserialize(
                JsonElement json,
                Type type,
                JsonDeserializationContext context) throws JsonParseException {
            if (json.isJsonPrimitive()) {
                JsonPrimitive primitive = (JsonPrimitive) json;
                if (primitive.isString()) {
                    JobStatus.Kind kind = JobStatus.Kind.findFromSymbol(primitive.getAsString());
                    if (kind != null) {
                        return kind;
                    }
                }
            }
View Full Code Here

Examples of com.google.gson.JsonPrimitive

            return;
        }

        @Override
        public JsonElement serialize(ExecutionPhase src, Type type, JsonSerializationContext context) {
            return new JsonPrimitive(src.getSymbol());
        }
View Full Code Here

Examples of com.google.gson.JsonPrimitive

     * @param id
     *            id of the entry to add the comment to
     * @return the id of the comment that was added
     */
    public Long addComment(String comment, Long id) {
        String body = "{\"body\":" + new JsonPrimitive(comment).toString() + "}";
        try {
            return doAuthenticatedPost(DailyMileUtil.buildCommentUrl(id), body);
        } catch (Exception e) {
            throw new RuntimeException("Unable to add comment", e);
        }
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.