Uploaded image for project: 'Commons Configuration'
  1. Commons Configuration
  2. CONFIGURATION-117

[configuration] MapConfiguration doesn't support multiple-valued properties

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.1
    • None
    • None
    • None
    • Operating System: other
      Platform: Other

    • 35945

    Description

      The MapConfiguration addPropertyDirect method does not support multiple-valued properties. The following implementation is what I used to fix the problem.

      protected void addPropertyDirect(String key, Object obj) {
      Object currentValue = getProperty(key);
      if (currentValue == null)

      { getMap().put(key, obj); }

      else if (List.class.isAssignableFrom(currentValue.getClass()))

      { ((List) currentValue).add(obj); }

      else

      { List values = new ArrayList(); values.add(currentValue); values.add(obj); getMap().put(key, values); }

      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            bate@technoetic.com Steve Bate
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: