Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support @JsonAnySetter on method with single Map parameter #4889

Open
cowtowncoder opened this issue Jan 7, 2025 Discussed in #4888 · 0 comments
Open

Support @JsonAnySetter on method with single Map parameter #4889

cowtowncoder opened this issue Jan 7, 2025 Discussed in #4888 · 0 comments

Comments

@cowtowncoder
Copy link
Member

Discussed in #4888

Originally posted by chrylis January 7, 2025
Currently, @JsonAnySetter can be used on a physical field of type Map, but unlike @JsonProperty, it will be silently dropped if used on a method of arity other than two (POJOPropertiesCollector#_addMethods). I would like to be able to use @JsonAnySetter on a method representing a virtual property, like this:

@Slf4j
class WebhookDto {
  @JsonAnySetter
  void setUnmappedProperties(Map<String, Object> unmapped) {
    log.warn("unmapped properties on webhook: {}", unmapped)
  }
}
```</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant