jackson-databind icon indicating copy to clipboard operation
jackson-databind copied to clipboard

Support @JsonAnySetter on method with single Map parameter

Open cowtowncoder opened this issue 9 months ago • 5 comments

Discussed in https://github.com/FasterXML/jackson-databind/discussions/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>

cowtowncoder avatar Jan 07 '25 18:01 cowtowncoder