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

    https://github.com/apache/incubator-brooklyn/pull/83#discussion_r15517588
  
    --- Diff: core/src/main/java/brooklyn/util/task/TaskBuilder.java ---
    @@ -112,18 +114,30 @@
             tags.add(tag);
             return this;
         }
    +    
    +    /** adds a flag to the given task */
    +    public TaskBuilder<T> flag(String flag, Object value) {
    +        flags.put(flag, value);
    +        return this;
    +    }
    +
    +    /** adds the given flags to the given task */
    +    public TaskBuilder<T> flags(Map<String,Object> flags) {
    +        this.flags.putAll(flags);
    +        return this;
    +    }
     
         @SuppressWarnings({ "unchecked", "rawtypes" })
         public Task<T> build() {
    -        MutableMap<String, Object> flags = MutableMap.of();
    -        if (name!=null) flags.add("displayName", name);
    -        if (description!=null) flags.add("description", description);
    -        if (!tags.isEmpty()) flags.add("tags", tags);
    +        MutableMap<String, Object> taskFlags = MutableMap.copyOf(flags);
    +        if (name!=null) taskFlags.add("displayName", name);
    --- End diff --
    
    If not doing it fluent-style, then use `put`. I had to go to the method to 
check semantics of `mutableMap.add` so guessing others will have to do the same.


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