Skip to content

Methods starting with "is" are ignored #443

Closed Answered by CarstenWickner
kevin-yu-0602 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @kevin-yu-0602,

your observation is correct. Inside the JacksonModule, when checking for a getter method's visibility, the underlying field is being considered too, which falls on your feet here it seems.
There is no JacksonOption for disabling this, but I made the corresponding methods protected so you may override them, e.g. like this:

new JacksonModule(JacksonOption.INCLUDE_ONLY_JSONPROPERTY_ANNOTATED_METHODS) {
    @Override
    protected boolean shouldIgnoreField(FieldScope field) {
        // bypass undesired filtering based on fields; also affects getter methods that Jackson doesn't recognize as such
        // e.g., when the field and method name are the same
        return false

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kevin-yu-0602
Comment options

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