Skip to content

Unexpected @JsonIgnore Annotation Application on Custom isXxx() Method with Non-Boolean Field #257

Closed Answered by cowtowncoder
fengziboboy asked this question in Q&A
Discussion options

You must be logged in to vote

This is behaving as intended: only name of field needs to match accessor-implied name; types not.
(there is logic for requiring boolean or Boolean for "is-getter"s, however -- but getter/setter/field types need not match; also note there is MapperFeature.ALLOW_IS_GETTERS_FOR_NON_BOOLEAN to allow non-boolean-valued getters)

So this is behaving as designed. If you want to include field in such case, add separate @JsonProperty (in addition to @JsonIgnore on accessor).

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@fengziboboy
Comment options

@cowtowncoder
Comment options

Comment options

You must be logged in to vote
2 replies
@fengziboboy
Comment options

@cowtowncoder
Comment options

Answer selected by JooHyukKim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants