Uploaded image for project: 'Tamaya'
  1. Tamaya
  2. TAMAYA-252

Use PropertyValue also as SPI for listing of properties in a PropertySource

    XMLWordPrintableJSON

Details

    Description

      As of now accessing multiple properties (aka the Map) from a PropertySource returns Map<String,String>. This has several drawbacks:

      • When combining maps from multiple sources it may not always be clear, which properties belong to which source, especially when meta-properties are added as well. This quite probably ends up in mix of meta-properties.
      • The exact formatting of meta-properties can be delayed as well, since with PropertyValue a multi-value capable abstraction is already in place.
      • Similarly combining values from multiple property sources is simpler because it is possible to more easily add meta-data entries, which may be necessary, e.g. when evaluating collection entries.
      • This also allows evaluation of the raw values (single or all) to be extracted into a separate SPI: This could be added transparently as a core SPI, so the API is not affected here.

      The disadvantage is that this change breaks the current PropertySource interface. Similarly it is also useful to adapt PropertyValueCombinationPolicy and PropertyFilter to operate on PropertyValue· instead of Map<String,String.

      Proposed API change:

      Old:

      public interface PropertySource{
        [...]
        Map<String,String> getProperties();
      }
      
      public interface PropertyValueCombinationPolicy{
        Map<String,String> collect(Map<String,String> currentValue, String key, 
                                                    PropertySource propertySource);
      }
      
      public interface PropertyFilter{
        String filterProperty(String value, FilterContext context);
      }
      

      New:

      public interface PropertySource{
        [...]
        Map<String,PropertyValue> getProperties();
      }
      
      public interface PropertyFilter{
        PropertyValue filterProperty(PropertyValue value, FilterContext context);
      }
      
      public interface PropertyValueCombinationPolicy{
        PropertyValue collect(PropertyValue currentValue, String key, 
                                           PropertySource propertySource);
      }
      

      Attachments

        There are no Sub-Tasks for this issue.

        Activity

          People

            anatole Anatole Tresch
            anatole Anatole Tresch
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 8h
                8h
                Remaining:
                Remaining Estimate - 8h
                8h
                Logged:
                Time Spent - Not Specified
                Not Specified