Skip to content

Data Binder: Auto-grow collections as needed to support nested property binding [SPR-6033] #10702

@spring-projects-issues

Description

@spring-projects-issues

Keith Donald opened SPR-6033 and commented

Grails, SpEL, and the new PresentationModel under development for 3.1 all include this feature. We should consider building this natively into DataBnder to benefit existing users & so Grails particularly no-longer has to maintain its own extensions.

Scenario illustrating feature behavior:

Alternate scenario:

  • Attempting to bind to index property path bar.baz[5] = 'hello'; say baz is not null, but only has a size of 1 at index = 0.
  • In this scenario, new default instances of the List's parameterized type e.g. String in the case of List<String> will be added at index 1..3; baz[4] would then be set to 'hello'.

As a developer, this frees me from having to pre-populate a indexed object graph ahead of time when binding back a Form post; I can simply rely on what the client is submitting to drive the population of the object graph. This is convenient


Affects: 3.0 M4

Issue Links:

Referenced from: commits 3fa533d

1 votes, 2 watchers

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coreIssues in core modules (aop, beans, core, context, expression)in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions