Details
-
Improvement
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
0.2-incubating
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.