Jackson JSON Processor
  1. Jackson JSON Processor
  2. JACKSON-275

Add support for multi-argument setters, to handle co-constraints

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.5
    • Fix Version/s: None
    • Component/s: Deserializer
    • Labels:
      None
    • Number of attachments :
      0

      Description

      There are use cases where it would be useful to have "setters" that take more than one arguments: for example, there are data formats where type information for a property is stored within another property and not within property object itself. This could be handled by using 2-parameter "setter" method.

      Such setters would need to

      1. Be annotated with @JsonSetter method
      2. Have @JsonProperty annotations for every parameter to give logical property name to bind (since parameter names are not stored in class byte code)

      In future it might also make sense to consider adding something like @JsonContext or @JsonInject to allow injecting non-property information (for example, ObjectMapper or DeserializationContext reference); but for now, simple multi-argument setter would be enough.

      Implementation may not be trivial, but similar bundling is already handled for creator (constructor) parameters so this seems doable.

        Activity

        Hide
        Tatu Saloranta added a comment -

        Should be implemented for 1.7.0, very useful for ensuring co-constraints.

        Show
        Tatu Saloranta added a comment - Should be implemented for 1.7.0, very useful for ensuring co-constraints.
        Hide
        Tatu Saloranta added a comment -

        Not much interest here; plus, rather non-trivial to implement.

        Show
        Tatu Saloranta added a comment - Not much interest here; plus, rather non-trivial to implement.

          People

          • Assignee:
            Tatu Saloranta
            Reporter:
            Tatu Saloranta
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: