brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (BROOKLYN-271) ConfigKey card shows object hashCode of default values
Date Sat, 28 May 2016 14:30:13 GMT

    [ https://issues.apache.org/jira/browse/BROOKLYN-271?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15305419#comment-15305419
] 

ASF GitHub Bot commented on BROOKLYN-271:
-----------------------------------------

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

    https://github.com/apache/brooklyn-server/pull/146#discussion_r64989547
  
    --- Diff: api/src/main/java/org/apache/brooklyn/api/entity/EntitySpec.java ---
    @@ -432,5 +432,10 @@ public Entity getParent() {
         private void checkMutable() {
             if (immutable) throw new IllegalStateException("Cannot modify immutable entity
spec "+this);
         }
    -    
    +
    +    @Override
    +    public String toString(){
    +        return getClass().getName();
    --- End diff --
    
    Interestingly, there is already a `toString`, inherited from `AbstractBrooklynObjectSpec`.
That will include the entity type, and will append `+"@"+Integer.toHexString(System.identityHashCode(this)`!
    
    I can see why we might want the identityHashCode (so that when looking at the logs we
can tell if something is using the same instance). But on-balance, I think it's fine to not
include it. Therefore, instead of this impl I suggest you change `AbstractBrooklynObjectSpec`
to be:
    
        @Override
        public String toString() {
            return Objects.toStringHelper(this).omitNullValues()
                    .add("type", type)
                    .add("displayName", displayName)
                    .toString();
        }



> ConfigKey card shows object hashCode of default values
> ------------------------------------------------------
>
>                 Key: BROOKLYN-271
>                 URL: https://issues.apache.org/jira/browse/BROOKLYN-271
>             Project: Brooklyn
>          Issue Type: Documentation
>            Reporter: Jose Carrasco
>            Priority: Minor
>
> ConfigKey cards of Entities show the object references in Brooklyn Catalog when a default
value is a object. Take a look to the following screenshot:
> !https://www.dropbox.com/s/rav70zzleyhnd4q/objectId.png?dl=1!
> As you can see the default value is composed by: 
> {code}
>     getClass().getName() + '@' + Integer.toHexString(hashCode())
> {code}
> Probably just class name should be shown here. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message