Skip to content

Commit

Permalink
[thing] Add toString overrides to ThingImpl & BridgeImpl (#4382)
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Hotze <[email protected]>
  • Loading branch information
florian-h05 committed Sep 19, 2024
1 parent 5f14cd1 commit 437a885
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
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

0 comments on commit 437a885

Please sign in to comment.