Package cc.plural.jsonij

Examples of cc.plural.jsonij.Value


        }
        return value;
    }

    protected Value marshalJavaString(Object o) {
        Value value = null;
        String marshaledString = (String) o;
        if (marshaledString != null) {
            value = new JSON.String(marshaledString);
        } else {
            value = JSON.NULL;
View Full Code Here


        }
        return value;
    }

    protected Value marshalJavaArray(Object o, CycleDetector cycleDetector) {
        Value value = null;
        if (o != null) {
            JSON.Array<Value> marshaledArray = new JSON.Array<Value>();
            int size = Array.getLength(o);
            Class<?> type = o.getClass();
            Class<?> componentType = type.getComponentType();
View Full Code Here

        }
        return value;
    }

    protected Value marshalJavaList(Object o, CycleDetector cycleDetector) {
        Value value = null;
        List<?> marshaledList = (List<?>) o;
        if (marshaledList != null) {
            JSON.Array<Value> marshaledArray = new JSON.Array<Value>();
            Iterator<?> marshaledListIterator = marshaledList.listIterator();
            Object listItem = null;
View Full Code Here

        }
        return value;
    }

    protected Value marshalJavaMap(Object o, CycleDetector cycleDetector) {
        Value value = null;
        Map<?, ?> marshaledMap = (Map<?, ?>) o;
        if (marshaledMap != null) {
            JSON.Object<JSON.String, Value> marshaledObject = new JSON.Object<JSON.String, Value>();
            Iterator<?> keySetIterator = marshaledMap.keySet().iterator();
            while (keySetIterator.hasNext()) {
View Full Code Here

        }
        return value;
    }

    protected Value marshalJavaObject(Object o, CycleDetector cycleDetector) {
        Value marshaledValue = javaObjectMarshaler.marshalJavaObject(o, cycleDetector);
        return marshaledValue;
    }
View Full Code Here

                                expressionStringBuilder.append(c);
                                predicateComponentBuilder.append(c);
                            }
                            value = predicateComponentBuilder.toString().trim();
                            JSONParser jsonParser = new JSONParser();
                            Value jsonValue = jsonParser.parseValue(value);
                            target.skipWhitepace(expressionStringBuilder);
                            OperatorExpressionPredicateCondition predicateCondition = new OperatorExpressionPredicateCondition(attribute, expressionPredicateOperator, jsonValue);
                            if(op != null) {
                                predicateCondition.setCombine(op);
                                op = null;
View Full Code Here

    }

    @SuppressWarnings("unused")
    public void testEmptyString() throws IOException, ParserException {
        try {
            Value v = parser.parse("");
            fail();
        } catch (Exception e) {
        }
    }
View Full Code Here

        } catch (Exception e) {
        }
    }

    public void testParseObject() throws IOException, ParserException {
        Value v = parser.parse("{}");

        assertTrue(v.isNull());

        v = parser.parse("{\"name\":\n1}");

        assertEquals(v.get("name").getInt(), 1);

        v = parser.parse("{\"name\":\n1.2}");

        assertEquals(v.get("name").getDouble(), 1.2);

        v = parser.parse("{\"name\":\n[1]}");

        assertEquals(v.get("name").get(0).getInt(), 1);

        v = parser.parse("{\"name\":\n\"hello\"}");

        assertEquals(v.get("name").toString(), "hello");

        v = parser.parse("{}");
       
        assertEquals(v.toJSON(), "{}");
    }
View Full Code Here

       
        assertEquals(v.toJSON(), "{}");
    }

    public void testParseArray() throws IOException, ParserException {
        Value v = parser.parse("[]");
        if (!(v instanceof JSON.Array<?>)) {
            fail();
        }
        JSON.Array<JSON.String> vArray = (JSON.Array<JSON.String>) v;
        if (vArray.size() != 0) {
View Full Code Here

            fail();
        }
    }

    public void testParseString() throws IOException, ParserException {
        Value v = parser.parse(" [ \n1.20, 234, null, \"John\",true,    \n\n\n\t     - 33, 234E-34, 0.23E23  ,[33, true],   false    ]");
        System.out.println("" + v.nestedSize() + ": " + v.toJSON());
        v = parser.parse("[1.2, 234, null, \"John\", true, -33, 2.34E-32, 0.23, [33, true], false]");
        System.out.println("" + v.nestedSize() + ": " + v.toJSON());
        v = parser.parse("{\"name\":\"John\", \"data\": [1,2,3,4,5,6]}");
        System.out.println("" + v.nestedSize() + ": " + v.toJSON());
        v = parser.parse("{\"na$me\":\"John\",                          \"blah\": {\"silly\": [[[2, [[[[[[[true]]]]]]]]], -55]}}");
        System.out.println("" + v.nestedSize() + ": " + v.toJSON());
    }
View Full Code Here

TOP

Related Classes of cc.plural.jsonij.Value

Copyright © 2018 www.massapicom. 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.