Uploaded image for project: 'mdsal'
  1. mdsal
  2. MDSAL-553

Add BindingMap to help with interfacing with keyed lists (Maps)

    XMLWordPrintable

Details

    • Improvement
    • Status: Resolved
    • Medium
    • Resolution: Done
    • None
    • 7.0.0, 6.0.6
    • Binding Spec
    • None

    Description

      Current Builders allow setting properties only as an entire field. This is ends up being clunky, as we really want them to be built in a fluent way.

      This is especially problematic with Map-based properties, as populating the map requires the product to be present to extract the key:

      Map<Bar> bars = ...;
      Bar tmp = new BarBuilder().setName("one").build();
      bars.put(tmp.key(), tmp);
      tmp = new BarBuilder().setName("two").build();
      bars.put(tmp.key(), tmp);
      Foo foo = new FooBuilder().setBar(bars).build();
      

      with the empty/null equivalence, we can improve this to something like:

      Foo foo = new FooBuilder()
          .addBar(new BarBuilder().setName("one").build())
          .addBar(new BarBuilder().setName("two").build())
          .build();
      

      Since these methods are shifting backing structure maintenance to the builder, we also need to ensure proper encapsulation of copy mechanics.

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            ilyaigushev Ilya Igushev
            rovarga Robert Varga
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: