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

    https://github.com/apache/brooklyn-server/pull/229#discussion_r70794277
  
    --- Diff: 
camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityDecorationResolver.java
 ---
    @@ -181,19 +181,17 @@ protected void addDecorationFromJsonMap(Map<?, ?> 
decorationJson, List<EntityIni
         public static class SpecParameterResolver extends 
BrooklynEntityDecorationResolver<SpecParameter<?>> {
     
             protected 
SpecParameterResolver(BrooklynYamlTypeInstantiator.Factory instantiator) { 
super(instantiator); }
    -        @Override protected String getDecorationKind() { return "Spec 
Parameter initializer"; }
    +
    +        @Override
    +        protected String getDecorationKind() { return "Spec Parameter 
initializer"; }
     
             @Override
             public void decorate(EntitySpec<?> entitySpec, ConfigBag attrs) {
                 List<? extends SpecParameter<?>> explicitParams = 
buildListOfTheseDecorationsFromEntityAttributes(attrs);
    -            // TODO see discussion at EntitySpec.parameters; 
    -            // maybe we should instead inherit always, or 
    -            // inherit except where it is set as config and then add the 
new explicit ones
    -            if (!explicitParams.isEmpty()) {
    -                entitySpec.parameters(explicitParams);
    -            }
    -            if (entitySpec.getParameters().isEmpty()) {
    -                
entitySpec.parameters(BasicSpecParameter.fromSpec(instantiator.loader.getManagementContext(),
 entitySpec));
    +            if (explicitParams.size() > 0) {
    +                BasicSpecParameter.addParameters(entitySpec, 
explicitParams, instantiator.loader);
    +            } else {
    +                BasicSpecParameter.addParameters(entitySpec, 
ImmutableList.<SpecParameter<?>>of(), instantiator.loader);
    --- End diff --
    
    No need for an `if-else` here. Above case handles all code paths.


---
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