Examples of Kson


Examples of org.nustaq.kson.Kson

        int someValue;
    }

    @Test
    public void testPojoConf() throws Exception {
        Kson kk = new Kson()
            .map("test", SomePojoConfig.class)
            .map("pojo", PojoConfigItem.class)
            .map("other", OtherPojoConfigItem.class);
        SomePojoConfig result = (SomePojoConfig) kk.readObject( new File("./src/test/kson/test.kson"));
        Assert.assertTrue(result.aList.get(1).nameList[0].equals("Short"));
        Assert.assertTrue(result.untypedList.size() == 2);

        String res = kk.writeObject(result);
        System.out.println(res);

        Object reRead = kk.readObject(res);
        Assert.assertTrue(DeepEquals.deepEquals(result, reRead));

        res = kk.writeJSonObject(result, true);
        System.out.println(res);

    }
View Full Code Here

Examples of org.nustaq.kson.Kson

    }

    @Test
    public void testJSonConf() throws Exception
    {
        Kson kk = new Kson()
            .map("test", SomePojoConfig.class)
            .map("pojo", PojoConfigItem.class)
            .map("other", OtherPojoConfigItem.class);
        SomePojoConfig result = (SomePojoConfig) kk.readObject( new File("./src/test/kson/test.json"), "test" );

        String res = kk.writeJSonObject(result,true);
        System.out.println(res);
        Object reRead = kk.readObject(res);
        Assert.assertTrue(DeepEquals.deepEquals(result,reRead));
    }
View Full Code Here

Examples of org.nustaq.kson.Kson

        cust.setName("John Doe");
        cust.setId(1);
        cust.getPhoneNumbers().add(new KsonPhoneNumber("home", "345 34592-0"));
        cust.getPhoneNumbers().add(new KsonPhoneNumber("work", "345 34592-1"));

        Kson kk = new Kson().map("customer", KsonCustomer.class).map("phone", KsonPhoneNumber.class);
        System.out.println(kk.writeObject(cust));
        System.out.println(kk.writeJSonObject(cust, false));

    }
View Full Code Here

Examples of org.nustaq.kson.Kson

    }

    @Test
    public void testBasics() throws Exception {
        Kson kk = new Kson()
                .map("arraytest", KKPrimitiveArray.class)
                .map("bignums", KKBigNums.class);
        serDeserObject(kk, new KKPrimitiveArray().setVals());
        serDeserObject(kk, new KKBigNums().setVals());
    }
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.