-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix BROOKLYN-271: Avoiding object hashcode in entities' toString. #146
Conversation
@aledsage I think it should be better than apache/brooklyn-docs#68 |
Thanks @kiuby88 - agreed this will improve the auto-generated entity docs (as per BROOKLYN-271). In general, I like the toString to give more specifics about the object where possible. That is possible for some of these, and not for others. I'll comment on individual methods where I think we could include more. |
|
||
@Override | ||
public String toString(){ | ||
return getClass().getName(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd go for the code below (using com.google.common.base.Objects
):
@Override
public String toString() {
return Objects.toStringHelper(this)
.add("minDatapoints", minDatapoints)
.add("timeToConsider", timeToConsider)
.add("maxProportionFailures", maxProportionFailures)
.toString();
}
@Override | ||
public String toString(){ | ||
return getClass().getName(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @kiuby88 - merging. I incorrectly marked BROOKLYN-271 as resolved before this PR (and apache/brooklyn-library#38) were merged - sorry about that, and thanks for spotting! |
Fixing BROOKLYN-271
Avoiding object references in catalog ConfigKey cards, for example:
Last picture shows that default value of
softwareProcess.lifecycleTasks
config key does not contain the object hashcode@XXXXX
. Then, objectstoString
methods are modified to avoid the hashcode.