Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-5355

Allow to use properties having dots with configuration proxies

    XMLWordPrintableJSON

Details

    Description

      Recently, a new feature has been introduced in DM to allow injecting type-safe configuration proxies when a ConfigurationDependency is used (see FELIX-5177).

      The principle is to deduce the name of a given property from a corresponding method name of the configuration proxy interface.

      However, in some cases, you have some component depending on some configuration with properties having some dots ("."), and this character can't be used in java methods. Of course, the properties can be renamed to new names without dots, but in some cases, when you want to use configuration proxies on some legacy components, you often can't modify the existing configuration properties.

      So, I would like to propose the attached patch which allows the support of dots in properties. the patch does the same done by DS: it maps the "_" charater to ".". And if the property contains "_" character, then you can use a double "__" underscore:

      For example, assuming you have the two properties in the configuration:

      foo.param1=123
      foo_param2=456
      

      then you can use the following method names:

          public interface MyConfig {
              public String getFoo_param1(); // maps to "foo.param1"
              public String getFoo__param2(); // maps to "foo_param2"
         }
      

      Is there any objections if I commit the attached patch ?

      thanks.

      Attachments

        1. FELIX-5355.patch
          6 kB
          Pierre De Rop

        Activity

          People

            pderop Pierre De Rop
            pderop Pierre De Rop
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: