brooklyn-dev mailing list archives

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


ASF GitHub Bot commented on BROOKLYN-271:

Github user aledsage commented on a diff in the pull request:
    --- Diff: api/src/main/java/org/apache/brooklyn/api/entity/ ---
    @@ -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:
        public String toString() {
            return Objects.toStringHelper(this).omitNullValues()
                    .add("type", type)
                    .add("displayName", displayName)

> ConfigKey card shows object hashCode of default values
> ------------------------------------------------------
>                 Key: BROOKLYN-271
>                 URL:
>             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:
> !!
> 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

View raw message