Package com.alibaba.fastjson.serializer

Examples of com.alibaba.fastjson.serializer.ValueFilter


public class FilterDemo extends TestCase {

    public void test_secure() throws Exception {

        ValueFilter filter = new ValueFilter() {

            public Object process(Object source, String name, Object value) {
                if (name.equals("name")) {
                    return "WSJ";
                }
View Full Code Here


import com.alibaba.json.bvt.serializer.PropertyFilterTest.A;

public class ValueFilterTest extends TestCase {

    public void test_valuefilter() throws Exception {
        ValueFilter filter = new ValueFilter() {

            public Object process(Object source, String name, Object value) {
                if (name.equals("id")) {
                    return "AAA";
                }
View Full Code Here

        String text = out.toString();
        Assert.assertEquals("{\"id\":\"AAA\"}", text);
    }

    public void test_valuefilter_1() throws Exception {
        ValueFilter filter = new ValueFilter() {

            public Object process(Object source, String name, Object value) {
                if (name.equals("name")) {
                    return "AAA";
                }
View Full Code Here

        String text = out.toString();
        Assert.assertEquals("{\"id\":0,\"name\":\"AAA\"}", text);
    }

    public void test_valuefilter_2() throws Exception {
        ValueFilter filter = new ValueFilter() {

            public Object process(Object source, String name, Object value) {
                if (name.equals("name")) {
                    return "AAA";
                }
View Full Code Here

        String text = out.toString();
        Assert.assertEquals("{\"name\":\"AAA\"}", text);
    }

    public void test_valuefilter_3() throws Exception {
        ValueFilter filter = new ValueFilter() {

            public Object process(Object source, String name, Object value) {
                if (name.equals("name")) {
                    return null;
                }
View Full Code Here

                public String process(Object source, String name, Object value) {
                    return name;
                }
               
            });
            serializer.getValueFilters().add(new ValueFilter() {
               
                public Object process(Object source, String name, Object value) {
                    if ("v".endsWith(name)) {
                        return "xxx";
                    }
View Full Code Here

                    }
                    return name;
                }
               
            });
            serializer.getValueFilters().add(new ValueFilter() {
               
                public Object process(Object source, String name, Object value) {
                    if ("v".endsWith(name)) {
                        return "xxx";
                    }
View Full Code Here

                    }
                    return name;
                }
               
            });
            serializer.getValueFilters().add(new ValueFilter() {
               
                public Object process(Object source, String name, Object value) {
                    if ("v".endsWith(name)) {
                        return "xxx";
                    }
View Full Code Here

                public String process(Object source, String name, Object value) {
                    return name;
                }
               
            });
            serializer.getValueFilters().add(new ValueFilter() {
               
                public Object process(Object source, String name, Object value) {
                    if ("v".endsWith(name)) {
                        return "xxx";
                    }
View Full Code Here

import com.alibaba.json.bvt.serializer.PropertyFilterTest.A;

public class ValueFilterTest extends TestCase {

    public void test_valuefilter() throws Exception {
        ValueFilter filter = new ValueFilter() {

            public Object process(Object source, String name, Object value) {
                if (name.equals("id")) {
                    return "AAA";
                }
View Full Code Here

TOP

Related Classes of com.alibaba.fastjson.serializer.ValueFilter

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.