Skip to content

Child matcher is applied to parent class if there is no parent matcher #12

Closed
@monitorjbl

Description

@monitorjbl

All values on TestObject will be excluded if you specify a matcher like this on another class:

TestObject ref = new TestObject();
ref.setStr1("str");
ref.setInt1(3);
TestSubobject sub = new TestSubobject();
sub.setVal("val1");
sub.setOtherVal("val2");
ref.setSub(sub);

String serialized = sut.writeValueAsString(JsonView.with(ref).onClass(TestSubobject.class, match()
    .exclude("*")
    .include("otherVal")));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions