Skip to content

Support @JsonAnySetter on setter method (single Map parameter) #4889

Description

@cowtowncoder

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    pr-welcomeIssue for which progress most likely if someone submits a Pull Request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions