Package flexjson.transformer

Examples of flexjson.transformer.FlatDateTransformer


    @Test
    public void testInlineOnDate() {
        Date birthDate = buildPerson1().getBirthDate();
        JSONSerializer serializer = new JSONSerializer();
        serializer.transform(new FlatDateTransformer(""), Date.class);
        String json = serializer.serialize(birthDate);
        logger.info(json);
        assertEquals(json, "{\"month\":11,\"day\":13,\"year\":2007}");
    }
View Full Code Here


    @Test
    public void testInlineOnPersonWithFlatDate() {
        Person person = buildPerson1();
        JSONSerializer serializer = new JSONSerializer();
        serializer
                .transform(new FlatDateTransformer("birthDate"), Date.class)
                .exclude("loopClassOnes.loopClassTwo.loopClassOne");
        String json = serializer.serialize(person);
        logger.info(json);
        assertTrue(json.contains("\"birthDateMonth\":11,\"birthDateDay\":13,\"birthDateYear\":2007"));
    }
View Full Code Here

    @Test
    public void testInlineOnCandidate() {

        Candidate candidate = buildCandidate1();
        JSONSerializer serializer = new JSONSerializer();
        serializer.transform(new FlatDateTransformer("dateOfBirth"), Date.class);
        String json = serializer.serialize(candidate);
        logger.info(json);
        assertTrue(json.contains("\"dateOfBirthMonth\":11,\"dateOfBirthDay\":13,\"dateOfBirthYear\":2007,"));
        assertFalse(json.contains(",,"));
       
View Full Code Here

    @Test
    public void testInlineOnCandidateWithoutPrefix() {

        Candidate candidate = buildCandidate1();
        JSONSerializer serializer = new JSONSerializer();
        serializer.transform(new FlatDateTransformer(""), Date.class);
        String json = serializer.serialize(candidate);
        logger.info(json);
        assertTrue(json.contains("\"dateOfBirthMonth\":11,\"dateOfBirthDay\":13,\"dateOfBirthYear\":2007,"));
        assertFalse(json.contains(",,"));
View Full Code Here

        experienceList.add(builbExperience1());
        experienceList.add(buildExperience2());
        experienceList.add(buildExperience3());
        experienceList.add(buildExperience4());

        JSONSerializer serializer = new JSONSerializer().transform( new FlatDateTransformer(""), Date.class );
        String json = serializer.serialize(experienceList);
        logger.info(json);
    }
View Full Code Here

TOP

Related Classes of flexjson.transformer.FlatDateTransformer

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.