Hi,
When specifying @JsonInclude(value = JsonInclude.Include.CUSTOM,
valueFilter = FooFilter.class) on a *boolean *type, it is not applied, but
on *Boolean* types it *is* applied.
Is this intended behaviour?
Here's an example. Given this Spock test:
def 'zot'() {
given:
def foo = new Foo()
when:
def serialized = MAPPER.writeValueAsString(foo)
then:
print serialized
}
static class Foo {
Foo() {}
boolean someBoolean
Boolean customBoolean = true
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter =
FooFilter.class)
boolean isSomeBoolean() {
return someBoolean
}
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter =
FooFilter.class)
Boolean isCustomBoolean() {
return customBoolean
}
}
static class FooFilter {
@Override
boolean equals(Object o) {
return true
}
}
The filter is the same both for the boolean and Boolean field.
The resulting output would be that both fields should be excluded from the
serialization, but someBolean is included:
{
"someBoolean" : false
}
Through debugging, I see that BooleanMethodPropertyWriter is used for
someBoolean, and ObjectMethodPropertyWriter is used for the customBoolean.
The former does not implement the custom filtering.
Thanks in advance,
Vetle Leinonen-Roeim
--
You received this message because you are subscribed to the Google Groups
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.