Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-91488

Generate builder constructors for IDL-defined structs

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: IDL
    • None
    • Server Programmability

      Optional fields need to be set manually after construction of IDL-generated classes, which is cumbersome. Instead, IDL could generate constructor(s) that allow one to set optional arguments, perhaps through a builder API.

      e.g.

      auto foo = MyIdlStruct::builder(requiredArg1, requiredArg2).setOptionalArg("bar").build(); 

      This would avoid the need to construct instances of IDL-generated classes in immediately invoked lambdas or over the course of multiple setX statements.

            Assignee:
            Unassigned Unassigned
            Reporter:
            patrick.freed@mongodb.com Patrick Freed
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: