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

    https://github.com/apache/incubator-brooklyn/pull/352#discussion_r20646451
  
    --- Diff: core/src/main/java/brooklyn/event/feed/AbstractFeed.java ---
    @@ -79,7 +83,39 @@ public void setEntity(EntityLocal entity) {
                 ((EntityInternal)entity).feeds().addFeed(this);
             }
         }
    +
    +    protected void initUniqueTag(String uniqueTag, Object 
...valsForDefault) {
    +        if (Strings.isNonBlank(uniqueTag)) this.uniqueTag = uniqueTag;
    +        else if (Strings.isBlank(this.uniqueTag)) this.uniqueTag = 
getDefaultUniqueTag(valsForDefault);
    +    }
    +
    +    @Override
    +    public String getUniqueTag() {
    +        if (Strings.isBlank(uniqueTag)) initUniqueTag(null);
    +        return super.getUniqueTag();
    +    }
         
    +    protected String getDefaultUniqueTag(Object ...valsForDefault) {
    +        StringBuilder sb = new StringBuilder();
    +        sb.append(JavaClassNames.simpleClassName(this));
    +        if (valsForDefault.length==0) {
    +            sb.append("@");
    +            sb.append(hashCode());
    +        } else if (valsForDefault.length==1 && valsForDefault[0] 
instanceof Collection){
    +            sb.append(Strings.toUniqueString(valsForDefault[0], 80));
    +        } else {
    +            sb.append("[");
    +            boolean first = true;
    +            for (Object x: valsForDefault) {
    --- End diff --
    
    If we didn't need to do `Strings.toUniqueString(x, 80)` then yes, but we 
want that behaviour in case one of the items is a set


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