Skip to content

Commit

Permalink
[cleanup] Unify (a bit) toString() methods
Browse files Browse the repository at this point in the history
  • Loading branch information
aheritier committed Nov 24, 2019
1 parent 824d4ef commit b322638
Show file tree
Hide file tree
Showing 45 changed files with 383 additions and 483 deletions.
28 changes: 12 additions & 16 deletions src/main/java/org/zendesk/client/v2/model/Attachment.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,14 @@ public void setThumbnails(List<Photo> thumbnails) {

@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("Attachment");
sb.append("{id=").append(getId());
sb.append(", fileName='").append(getFileName()).append('\'');
sb.append(", contentType='").append(getContentType()).append('\'');
sb.append(", contentUrl='").append(getContentUrl()).append('\'');
sb.append(", size=").append(getSize());
sb.append(", thumbnails=").append(thumbnails);
sb.append('}');
return sb.toString();
return "Attachment" +
"{id=" + getId() +
", fileName='" + getFileName() + '\'' +
", contentType='" + getContentType() + '\'' +
", contentUrl='" + getContentUrl() + '\'' +
", size=" + getSize() +
", thumbnails=" + thumbnails +
'}';
}

public static class Upload {
Expand All @@ -56,12 +54,10 @@ public void setAttachments(List<Attachment> attachments) {

@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("Upload");
sb.append("{token='").append(token).append('\'');
sb.append(", attachments=").append(attachments);
sb.append('}');
return sb.toString();
return "Upload" +
"{token='" + token + '\'' +
", attachments=" + attachments +
'}';
}
}
}
20 changes: 9 additions & 11 deletions src/main/java/org/zendesk/client/v2/model/Audit.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,15 @@ public void setVia(Via via) {

@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("Audit");
sb.append("{authorId=").append(authorId);
sb.append(", id=").append(id);
sb.append(", ticketId=").append(ticketId);
sb.append(", metadata=").append(metadata);
sb.append(", via=").append(via);
sb.append(", createdAt=").append(createdAt);
sb.append(", events=").append(events);
sb.append('}');
return sb.toString();
return "Audit" +
"{authorId=" + authorId +
", id=" + id +
", ticketId=" + ticketId +
", metadata=" + metadata +
", via=" + via +
", createdAt=" + createdAt +
", events=" + events +
'}';
}

}
16 changes: 7 additions & 9 deletions src/main/java/org/zendesk/client/v2/model/Comment.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,12 @@ public void setPublic(Boolean isPublic) {

@Override
public String toString() {
final StringBuilder sb = new StringBuilder("Comment{");
sb.append("id=").append(id);
sb.append(", body='").append(body).append('\'');
sb.append(", authorId=").append(authorId);
sb.append(", attachments=").append(attachments);
sb.append(", createdAt=").append(createdAt);
sb.append(", uploads=").append(uploads);
sb.append('}');
return sb.toString();
return "Comment{" + "id=" + id +
", body='" + body + '\'' +
", authorId=" + authorId +
", attachments=" + attachments +
", createdAt=" + createdAt +
", uploads=" + uploads +
'}';
}
}
12 changes: 5 additions & 7 deletions src/main/java/org/zendesk/client/v2/model/Condition.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,11 @@ public void setValue(String value) {

@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("Condition");
sb.append("{field=").append(field);
sb.append(", operator=").append(operator);
sb.append(", value=").append(value);
sb.append('}');
return sb.toString();
return "Condition" +
"{field=" + field +
", operator=" + operator +
", value=" + value +
'}';
}

}
10 changes: 4 additions & 6 deletions src/main/java/org/zendesk/client/v2/model/Conditions.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,10 @@ public void setAny(List<Condition> any) {

@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("Conditions");
sb.append("{all=").append(all);
sb.append(", any=").append(any);
sb.append('}');
return sb.toString();
return "Conditions" +
"{all=" + all +
", any=" + any +
'}';
}

}
52 changes: 24 additions & 28 deletions src/main/java/org/zendesk/client/v2/model/Field.java
Original file line number Diff line number Diff line change
Expand Up @@ -237,28 +237,26 @@ public void setVisibleInPortal(Boolean visibleInPortal) {

@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("Field");
sb.append("{active=").append(active);
sb.append(", id=").append(id);
sb.append(", url='").append(url).append('\'');
sb.append(", type='").append(type).append('\'');
sb.append(", title='").append(title).append('\'');
sb.append(", description='").append(description).append('\'');
sb.append(", position=").append(position);
sb.append(", required=").append(required);
sb.append(", collapsedForAgents=").append(collapsedForAgents);
sb.append(", regexpForValidation='").append(regexpForValidation).append('\'');
sb.append(", titleInPortal='").append(titleInPortal).append('\'');
sb.append(", visibleInPortal=").append(visibleInPortal);
sb.append(", editableInPortal=").append(editableInPortal);
sb.append(", requiredInPortal=").append(requiredInPortal);
sb.append(", tag='").append(tag).append('\'');
sb.append(", createdAt=").append(createdAt);
sb.append(", updatedAt=").append(updatedAt);
sb.append(", customFieldOptions=").append(customFieldOptions);
sb.append('}');
return sb.toString();
return "Field" +
"{active=" + active +
", id=" + id +
", url='" + url + '\'' +
", type='" + type + '\'' +
", title='" + title + '\'' +
", description='" + description + '\'' +
", position=" + position +
", required=" + required +
", collapsedForAgents=" + collapsedForAgents +
", regexpForValidation='" + regexpForValidation + '\'' +
", titleInPortal='" + titleInPortal + '\'' +
", visibleInPortal=" + visibleInPortal +
", editableInPortal=" + editableInPortal +
", requiredInPortal=" + requiredInPortal +
", tag='" + tag + '\'' +
", createdAt=" + createdAt +
", updatedAt=" + updatedAt +
", customFieldOptions=" + customFieldOptions +
'}';
}

public static class Option implements Serializable {
Expand Down Expand Up @@ -292,12 +290,10 @@ public void setValue(String value) {

@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("Option");
sb.append("{name='").append(name).append('\'');
sb.append(", value='").append(value).append('\'');
sb.append('}');
return sb.toString();
return "Option" +
"{name='" + name + '\'' +
", value='" + value + '\'' +
'}';
}
}
}
16 changes: 7 additions & 9 deletions src/main/java/org/zendesk/client/v2/model/Group.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,12 @@ public void setUpdatedAt(Date updatedAt) {

@Override
public String toString() {
final StringBuilder sb = new StringBuilder("Group{");
sb.append("id=").append(id);
sb.append(", url='").append(url).append('\'');
sb.append(", name='").append(name).append('\'');
sb.append(", deleted=").append(deleted);
sb.append(", createdAt=").append(createdAt);
sb.append(", updatedAt=").append(updatedAt);
sb.append('}');
return sb.toString();
return "Group{" + "id=" + id +
", url='" + url + '\'' +
", name='" + name + '\'' +
", deleted=" + deleted +
", createdAt=" + createdAt +
", updatedAt=" + updatedAt +
'}';
}
}
16 changes: 7 additions & 9 deletions src/main/java/org/zendesk/client/v2/model/Macro.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,12 @@ public void setUpdatedAt(Date updatedAt) {

@Override
public String toString() {
final StringBuilder sb = new StringBuilder("Macro{");
sb.append("id=").append(id);
sb.append(", title='").append(title).append('\'');
sb.append(", active='").append(active).append('\'');
sb.append(", actions=").append(actions);
sb.append(", createdAt=").append(createdAt);
sb.append(", updatedAt=").append(updatedAt);
sb.append('}');
return sb.toString();
return "Macro{" + "id=" + id +
", title='" + title + '\'' +
", active='" + active + '\'' +
", actions=" + actions +
", createdAt=" + createdAt +
", updatedAt=" + updatedAt +
'}';
}
}
30 changes: 14 additions & 16 deletions src/main/java/org/zendesk/client/v2/model/Organization.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,21 +146,19 @@ public void setOrganizationFields(Map<String, Object> organizationFields) {

@Override
public String toString() {
final StringBuilder sb = new StringBuilder("Organization{");
sb.append("id=").append(id);
sb.append(", externalId='").append(externalId).append('\'');
sb.append(", name='").append(name).append('\'');
sb.append(", createdAt=").append(createdAt);
sb.append(", updatedAt=").append(updatedAt);
sb.append(", domainNames=").append(domainNames);
sb.append(", details='").append(details).append('\'');
sb.append(", notes='").append(notes).append('\'');
sb.append(", groupId=").append(groupId);
sb.append(", sharedTickets=").append(sharedTickets);
sb.append(", sharedComments=").append(sharedComments);
sb.append(", tags=").append(tags);
sb.append(", organizationFields=").append(organizationFields);
sb.append('}');
return sb.toString();
return "Organization{" + "id=" + id +
", externalId='" + externalId + '\'' +
", name='" + name + '\'' +
", createdAt=" + createdAt +
", updatedAt=" + updatedAt +
", domainNames=" + domainNames +
", details='" + details + '\'' +
", notes='" + notes + '\'' +
", groupId=" + groupId +
", sharedTickets=" + sharedTickets +
", sharedComments=" + sharedComments +
", tags=" + tags +
", organizationFields=" + organizationFields +
'}';
}
}
22 changes: 10 additions & 12 deletions src/main/java/org/zendesk/client/v2/model/Photo.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,15 @@ public void setHeight(Long height) {

@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("Photo");
sb.append("{contentType='").append(contentType).append('\'');
sb.append(", id=").append(id);
sb.append(", fileName='").append(fileName).append('\'');
sb.append(", contentUrl='").append(contentUrl).append('\'');
sb.append(", size=").append(size);
sb.append(", width=").append(width);
sb.append(", height=").append(height);
sb.append(", inline=").append(inline);
sb.append('}');
return sb.toString();
return "Photo" +
"{contentType='" + contentType + '\'' +
", id=" + id +
", fileName='" + fileName + '\'' +
", contentUrl='" + contentUrl + '\'' +
", size=" + size +
", width=" + width +
", height=" + height +
", inline=" + inline +
'}';
}
}
78 changes: 37 additions & 41 deletions src/main/java/org/zendesk/client/v2/model/Ticket.java
Original file line number Diff line number Diff line change
Expand Up @@ -250,40 +250,38 @@ public void setIsPublic(Boolean isPublic) {

@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("Ticket");
sb.append("{assigneeId=").append(assigneeId);
sb.append(", id=").append(id);
sb.append(", url='").append(url).append('\'');
sb.append(", externalId='").append(externalId).append('\'');
sb.append(", type='").append(type).append('\'');
sb.append(", subject='").append(subject).append('\'');
sb.append(", description='").append(description).append('\'');
sb.append(", priority='").append(priority).append('\'');
sb.append(", status='").append(status).append('\'');
sb.append(", recipient='").append(recipient).append('\'');
sb.append(", requesterId=").append(requesterId);
sb.append(", submitterId=").append(submitterId);
sb.append(", organizationId=").append(organizationId);
sb.append(", groupId=").append(groupId);
sb.append(", collaboratorIds=").append(collaboratorIds);
sb.append(", forumTopicId=").append(forumTopicId);
sb.append(", problemId=").append(problemId);
sb.append(", hasIncidents=").append(hasIncidents);
sb.append(", dueAt=").append(dueAt);
sb.append(", tags=").append(tags);
sb.append(", via=").append(via);
sb.append(", customFields=").append(customFields);
sb.append(", satisfactionRating=").append(satisfactionRating);
sb.append(", sharingAgreementIds=").append(sharingAgreementIds);
sb.append(", followupIds=").append(followupIds);
sb.append(", ticketFormId=").append(ticketFormId);
sb.append(", brandId=").append(brandId);
sb.append(", isPublic=").append(isPublic);
sb.append(", createdAt=").append(createdAt);
sb.append(", updatedAt=").append(updatedAt);
sb.append('}');
return sb.toString();
return "Ticket" +
"{assigneeId=" + assigneeId +
", id=" + id +
", url='" + url + '\'' +
", externalId='" + externalId + '\'' +
", type='" + type + '\'' +
", subject='" + subject + '\'' +
", description='" + description + '\'' +
", priority='" + priority + '\'' +
", status='" + status + '\'' +
", recipient='" + recipient + '\'' +
", requesterId=" + requesterId +
", submitterId=" + submitterId +
", organizationId=" + organizationId +
", groupId=" + groupId +
", collaboratorIds=" + collaboratorIds +
", forumTopicId=" + forumTopicId +
", problemId=" + problemId +
", hasIncidents=" + hasIncidents +
", dueAt=" + dueAt +
", tags=" + tags +
", via=" + via +
", customFields=" + customFields +
", satisfactionRating=" + satisfactionRating +
", sharingAgreementIds=" + sharingAgreementIds +
", followupIds=" + followupIds +
", ticketFormId=" + ticketFormId +
", brandId=" + brandId +
", isPublic=" + isPublic +
", createdAt=" + createdAt +
", updatedAt=" + updatedAt +
'}';
}

public static class Requester {
Expand Down Expand Up @@ -336,13 +334,11 @@ public void setEmail(String email) {

@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("Requester");
sb.append("{localeId=").append(localeId);
sb.append(", name='").append(name).append('\'');
sb.append(", email='").append(email).append('\'');
sb.append('}');
return sb.toString();
return "Requester" +
"{localeId=" + localeId +
", name='" + name + '\'' +
", email='" + email + '\'' +
'}';
}
}

Expand Down
Loading

0 comments on commit b322638

Please sign in to comment.