Class ValueProvider


  • public class ValueProvider
    extends Object
    Helper to extract values from a set of Properties, potentially mixing it up with XML-based configuration based on the PropertyMode setting. Obtaining a value is done via data-type specific methods (such as getString(io.fabric8.maven.docker.config.handler.property.ConfigKey, java.lang.String)). The ConfigKey parameter tells us which property to look for, and how to handle combination of multiple values. For PropertyMode.Only we only look at the properties, ignoring any config value. For PropertyMode.Skip we only look at the config, ignoring any properties value. For PropertyMode.Override we use the property value if it is non-null, else the config value. For PropertyMode.Fallback we use the config value if it is non-null, else the property value. For Override and Fallback mode, merging may take place as dictated by the ValueCombinePolicy defined in the ConfigKey, or as overridden by the property <prefix.someproperty>._combine (EnvUtil.PROPERTY_COMBINE_POLICY_SUFFIX). If ValueCombinePolicy.Replace is used, only the prioritized value (first non-null) is used. If ValueCombinePolicy.Merge is used, the merge method depends on the data type. For simple types (string, int, long, boolean) this is not supported and will throw exception. For Lists, the non-null values will be appended to each other (with values from first source added first) For Maps, all maps are merged into one map, with data from the first map taking precedence. *
    Author:
    Johan Ström