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

Allow a user-defined order in the PropertiesConfigurationLayout.save method.

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.1
    • Component/s: Format
    • Labels:
      None
    • Flags:
      Patch, Important

      Description

      For .properties file manipulation, I have a use case that requires something like "addKeyAfterKey(String keyToAdd, String afterKey)". This allows a property to be written after some other property when saving.

      I have extended PropertiesConfigurationLayout to accomplish this new behavior. Unfortunately, the save method iterates over a private member (layoutData), so I have no control over the final file order.

      An easy fix for my use case would be to change line 564 of PropertiesConfigurationLayout.java to use the public getKeys() method instead of layoutData.keySet():

      FROM: for (String key : layoutData.keySet())
      TO:   for (String key : getKeys())
      

      Then I could override getKeys() to return the required order for saving.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              tlark Tim Lark
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: