Github user grkvlt commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/229#discussion_r70851697
  
    --- Diff: 
core/src/main/java/org/apache/brooklyn/core/objs/BasicSpecParameter.java ---
    @@ -384,5 +387,34 @@ public static WeightedParameter 
getFieldConfig(ConfigKey<?> config, Field config
             }
         }
     
    +    /**
    +     * Adds the given list of {@link SpecParameter parameters} to the 
provided
    +     * {@link AbstractBrooklynObjectSpec spec}. Inherits parent parameters 
except
    +     * where there is an existing {@link ConfigKey config key}.
    +     * <p>
    +     * Implemented by explicitly replacing the existing parameters with an
    +     * updated list.
    +     *
    +     * @see EntitySpec#parameters(List)
    +     */
    +    public static void addParameters(AbstractBrooklynObjectSpec<?, ?> 
spec, List<? extends SpecParameter<?>> explicitParams, 
BrooklynClassLoadingContext loader) {
    +        if (explicitParams.size() > 0) {
    +            List<SpecParameter<?>> currentParams = 
MutableList.copyOf(spec.getParameters());
    +            Map<ConfigKey<?>, ?> currentConfig = spec.getConfig();
    +            for (final SpecParameter<?> param : explicitParams) {
    +                Optional<ConfigKey<?>> configExists = 
Iterables.tryFind(currentConfig.keySet(), 
ConfigPredicates.nameEqualTo(param.getConfigKey().getName()));
    --- End diff --
    
    I was trying to deal with the situation where a config key exists on the 
class, and a value is set in the YAML for it, and did not want the parameter to 
override that value. I now think that this won't be a problem - the default 
value will change (perhaps) but the actual value set will be the value from the 
YAML brooklyn.config setting. I'll write some more tests for this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to