Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Labels.excludes预期效果不对 #1856

Closed
myoss opened this issue May 18, 2018 · 3 comments
Closed

Labels.excludes预期效果不对 #1856

myoss opened this issue May 18, 2018 · 3 comments
Assignees
Labels
Milestone

Comments

@myoss
Copy link
Contributor

myoss commented May 18, 2018

org.junit.ComparisonFailure: 
Expected :{"id":123,"info":"fofo","name":"wenshao"}
Actual   :{"info":"fofo"}

想排除掉 “AuditIdEntity” 的字段,但是直接吧 “LogicDeleteEntity” 的字段也排除掉了,我的用法不对吗?测试代码如下

 @Test
    public void test_excludes() throws Exception {
        VO vo = new VO();
        vo.setId(123);
        vo.setName("wenshao");
        vo.setPassword("ooxxx");
        vo.setInfo("fofo");

        String text = JSON.toJSONString(vo, Labels.excludes("AuditIdEntity"));
        Assert.assertEquals("{\"id\":123,\"info\":\"fofo\",\"name\":\"wenshao\"}", text);
    }

    public static class VO {

        private int    id;
        private String name;
        private String password;
        private String info;

        @JSONField(label = "LogicDeleteEntity")
        public int getId() {
            return id;
        }

        public void setId(int id) {
            this.id = id;
        }

        @JSONField(label = "LogicDeleteEntity")
        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        @JSONField(label = "AuditIdEntity")
        public String getPassword() {
            return password;
        }

        public void setPassword(String password) {
            this.password = password;
        }

        public String getInfo() {
            return info;
        }

        public void setInfo(String info) {
            this.info = info;
        }

    }
@myoss
Copy link
Contributor Author

myoss commented May 18, 2018

用的 1.2.47 这个版本

@myoss
Copy link
Contributor Author

myoss commented Jun 27, 2018

@wenshao 温少能否抽时间帮忙看看,万分感谢

@wenshao wenshao added the bug label Jun 27, 2018
@wenshao wenshao assigned liangfei0201 and wenshao and unassigned liangfei0201 Jun 27, 2018
@wenshao wenshao added this to the 1.2.49 milestone Jun 27, 2018
@wenshao
Copy link
Member

wenshao commented Aug 5, 2018

https://github.com/alibaba/fastjson/releases/tag/1.2.49
问题已修复,请用新版本

@wenshao wenshao closed this as completed Aug 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants