Skip to content
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

[thing] Add toString overrides to ThingImpl & BridgeImpl #4382

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,9 @@ public List<Thing> getThings() {
}
return bridgeHandler;
}

@Override
public String toString() {
return super.toString().replace("Bridge=False", "Bridge=True");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,31 @@ public boolean isEnabled() {
return ThingStatusDetail.DISABLED != getStatusInfo().getStatusDetail();
}

@Override
public String toString() {
// Configuration is deliberately excluded because it might include sensitive data like passwords.
StringBuilder sb = new StringBuilder(getUID().toString());
sb.append(" (ThingTypeUID=");
sb.append(getThingTypeUID());
sb.append(", Bridge=False");
if (getBridgeUID() != null) {
sb.append(", BridgeUID=");
sb.append(getBridgeUID());
}
sb.append(", Label=");
sb.append(getLabel());
if (getLocation() != null) {
sb.append(", Location=");
sb.append(getLocation());
}
sb.append(", Status=");
sb.append(getStatus());
sb.append(", StatusInfo=");
sb.append(getStatusInfo());
sb.append(")");
return sb.toString();
}

@Override
public int hashCode() {
final int prime = 31;
Expand Down