brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neykov <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #229: Merge brooklyn.parameters in YAML files
Date Thu, 28 Jul 2016 17:23:02 GMT
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/229#discussion_r72664225
  
    --- Diff: api/src/main/java/org/apache/brooklyn/api/internal/AbstractBrooklynObjectSpec.java
---
    @@ -153,17 +155,20 @@ public SpecT parameters(List<? extends SpecParameter<?>>
parameters) {
         @Beta
         public SpecT parametersAdd(List<? extends SpecParameter<?>> parameters)
{
             // parameters follows immutable pattern, unlike the other fields
    -        Builder<SpecParameter<?>> result = ImmutableList.<SpecParameter<?>>builder();
    -        if (this.parameters!=null)
    -            result.addAll(this.parameters);
    -        result.addAll( checkNotNull(parameters, "parameters") );
    -        this.parameters = result.build();
    +        Set<SpecParameter<?>> params = MutableSet.<SpecParameter<?>>copyOf(parameters);
    +        Set<SpecParameter<?>> current = MutableSet.<SpecParameter<?>>copyOf(this.parameters);
    +        current.removeAll(params);
    +
    +        this.parameters = ImmutableList.<SpecParameter<?>>builder()
    +                .addAll(params)
    +                .addAll(current)
    --- End diff --
    
    I really like how this turned out. We can use it to reorder/pull up parameters we are
interested in.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message