Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-9393

UtilMisc.toMap(), toList() and toSet() refactoring taking Varargs for creating the wanted data structure

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Trivial
    • Resolution: Implemented
    • Affects Version/s: Trunk
    • Fix Version/s: Upcoming Release
    • Component/s: framework
    • Labels:
      None

      Description

      This patch removes a number of outdated methods that took a fixed number of objects to create a data structure, such as a linked list. Since the code is outdated and inflexible, this patch removes these methods and added methods to create the given data structure via a variable amount of arguments. This approach also ensures that no other code needs a refactoring. In addition the method populateMap() was removed which was private and was only used by the multiple outdated toMap() functions.

        Activity

        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        Hi Martin,

        +1

        Show
        jacques.le.roux Jacques Le Roux added a comment - Hi Martin, +1
        Hide
        mbrohl Michael Brohl added a comment -

        Maybe we should just deprecate the old methods instead of removing them? In this way users who used this API in custom code have a chance to migrate their code without being forced in the next update.

        Show
        mbrohl Michael Brohl added a comment - Maybe we should just deprecate the old methods instead of removing them? In this way users who used this API in custom code have a chance to migrate their code without being forced in the next update.
        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        Martin said,

        This approach also ensures that no other code needs a refactoring

        I agree, because all the old methods are automatically replaced with the new with Varargs ones. Just appy the patch and compile to be convinced.

        Show
        jacques.le.roux Jacques Le Roux added a comment - Martin said, This approach also ensures that no other code needs a refactoring I agree, because all the old methods are automatically replaced with the new with Varargs ones. Just appy the patch and compile to be convinced.
        Hide
        mbrohl Michael Brohl added a comment -

        You are right. I should have known better that Martin already thought of this

        Show
        mbrohl Michael Brohl added a comment - You are right. I should have known better that Martin already thought of this
        Hide
        mbrohl Michael Brohl added a comment -

        Thanks Martin,

        your patch is in trunk at r1800299.

        Show
        mbrohl Michael Brohl added a comment - Thanks Martin, your patch is in trunk at r1800299.

          People

          • Assignee:
            mbrohl Michael Brohl
            Reporter:
            mbecker Martin Becker
          • Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development