Implement SubmitRecord.toString()
Having a working toString() makes it easier to output submit records in debug logs etc. Change-Id: I9dfe66de5580b432d0bfe86628b682511b835792
This commit is contained in:
committed by
Shawn O. Pearce
parent
a6ce960fa1
commit
3b106c14ae
@@ -84,5 +84,34 @@ public class SubmitRecord {
|
|||||||
public String label;
|
public String label;
|
||||||
public Status status;
|
public Status status;
|
||||||
public Account.Id appliedBy;
|
public Account.Id appliedBy;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append(label).append(": ").append(status);
|
||||||
|
if (appliedBy != null) {
|
||||||
|
sb.append(" by ").append(appliedBy);
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append(status);
|
||||||
|
if (status == Status.RULE_ERROR && errorMessage != null) {
|
||||||
|
sb.append('(').append(errorMessage).append(')');
|
||||||
|
}
|
||||||
|
sb.append('[');
|
||||||
|
if (labels != null) {
|
||||||
|
String delimiter = "";
|
||||||
|
for (Label label : labels) {
|
||||||
|
sb.append(delimiter).append(label);
|
||||||
|
delimiter = ", ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sb.append(']');
|
||||||
|
return sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user