Examples of SimplePropertyPreFilter


Examples of com.alibaba.fastjson.serializer.SimplePropertyPreFilter

        SimplePropertyPreFilter filter = new SimplePropertyPreFilter("id");
        Assert.assertEquals("{\"id\":123}", JSON.toJSONString(vo, filter));
    }
   
    public void test_map() throws Exception {
        SimplePropertyPreFilter filter = new SimplePropertyPreFilter(VO.class, "name");
        String text = JSON.toJSONString(map, filter);
        Assert.assertTrue("{\"id\":123,\"name\":\"sandzhangtoo\"}".equals(text) || "{\"name\":\"sandzhangtoo\",\"id\":123}".equals(text));
    }
View Full Code Here

Examples of com.alibaba.fastjson.serializer.SimplePropertyPreFilter

        String text = JSON.toJSONString(map, filter);
        Assert.assertTrue("{\"id\":123,\"name\":\"sandzhangtoo\"}".equals(text) || "{\"name\":\"sandzhangtoo\",\"id\":123}".equals(text));
    }
   
    public void test_map_id() throws Exception {
        SimplePropertyPreFilter filter = new SimplePropertyPreFilter("id");
        Assert.assertEquals("{\"id\":123}", JSON.toJSONString(map, filter));
    }
View Full Code Here

Examples of com.alibaba.fastjson.serializer.SimplePropertyPreFilter

        SimplePropertyPreFilter filter = new SimplePropertyPreFilter("id");
        Assert.assertEquals("{\"id\":123}", JSON.toJSONString(map, filter));
    }
   
    public void test_map_name() throws Exception {
        SimplePropertyPreFilter filter = new SimplePropertyPreFilter("name");
        Assert.assertEquals("{\"name\":\"sandzhangtoo\"}", JSON.toJSONString(map, filter));
    }
View Full Code Here

Examples of com.alibaba.fastjson.serializer.SimplePropertyPreFilter

        SimplePropertyPreFilter filter = new SimplePropertyPreFilter("name");
        Assert.assertEquals("{\"name\":\"sandzhangtoo\"}", JSON.toJSONString(map, filter));
    }
   
    public void test_all() throws Exception {
        SimplePropertyPreFilter filter = new SimplePropertyPreFilter(VO.class);
        String text = JSON.toJSONString(vo, filter);
        Assert.assertTrue("{\"id\":123,\"name\":\"sandzhangtoo\"}".equals(text) || "{\"name\":\"sandzhangtoo\",\"id\":123}".equals(text));
    }
View Full Code Here

Examples of com.alibaba.fastjson.serializer.SimplePropertyPreFilter

        String text = JSON.toJSONString(vo, filter);
        Assert.assertTrue("{\"id\":123,\"name\":\"sandzhangtoo\"}".equals(text) || "{\"name\":\"sandzhangtoo\",\"id\":123}".equals(text));
    }
   
    public void test_all_map() throws Exception {
        SimplePropertyPreFilter filter = new SimplePropertyPreFilter(VO.class);
        String text = JSON.toJSONString(map, filter);
        Assert.assertTrue("{\"id\":123,\"name\":\"sandzhangtoo\"}".equals(text) || "{\"name\":\"sandzhangtoo\",\"id\":123}".equals(text));
    }
View Full Code Here

Examples of com.alibaba.fastjson.serializer.SimplePropertyPreFilter

        String text = JSON.toJSONString(map, filter);
        Assert.assertTrue("{\"id\":123,\"name\":\"sandzhangtoo\"}".equals(text) || "{\"name\":\"sandzhangtoo\",\"id\":123}".equals(text));
    }
   
    public void test_exclude_id() throws Exception {
        SimplePropertyPreFilter filter = new SimplePropertyPreFilter(VO.class);
        filter.getExcludes().add("id");
        Assert.assertEquals("{\"name\":\"sandzhangtoo\"}", JSON.toJSONString(vo, filter));
    }
View Full Code Here

Examples of com.alibaba.fastjson.serializer.SimplePropertyPreFilter

        filter.getExcludes().add("id");
        Assert.assertEquals("{\"name\":\"sandzhangtoo\"}", JSON.toJSONString(vo, filter));
    }
   
    public void test_exclude_id_map() throws Exception {
        SimplePropertyPreFilter filter = new SimplePropertyPreFilter(VO.class);
        filter.getExcludes().add("id");
        Assert.assertEquals("{\"name\":\"sandzhangtoo\"}", JSON.toJSONString(vo, filter));
    }
View Full Code Here

Examples of com.alibaba.fastjson.serializer.SimplePropertyPreFilter

        filter.getExcludes().add("id");
        Assert.assertEquals("{\"name\":\"sandzhangtoo\"}", JSON.toJSONString(vo, filter));
    }
   
    public void test_exclude_name() throws Exception {
        SimplePropertyPreFilter filter = new SimplePropertyPreFilter(VO.class);
        filter.getExcludes().add("name");
        Assert.assertEquals("{\"id\":123}", JSON.toJSONString(vo, filter));
    }
View Full Code Here

Examples of com.alibaba.fastjson.serializer.SimplePropertyPreFilter

import com.alibaba.fastjson.serializer.SimplePropertyPreFilter;

public class Issue184 extends TestCase {

    public void test_for_issue() throws Exception {
        SimplePropertyPreFilter filter = new SimplePropertyPreFilter();
       
        VO vo = new VO();
        vo.setDate(new Date());
        String text = JSON.toJSONString(vo, filter);
        System.out.println(text);
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.