Skip to content

Commit

Permalink
Added toString() method to UserInfo.java. Perhaps useful for debugging?
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesGold23 committed Jun 10, 2014
1 parent 528f400 commit b922c56
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
26 changes: 25 additions & 1 deletion src/main/java/com/github/jreddit/user/UserInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public class UserInfo {
// UTC timestamp of creation date
private double createdUTC;

// Indicates whether this user is friend with the current one
// Indicates whether this user is friends with the currently connected one. Believe it or not, you can actually be
// friends with yourself. http://www.reddit.com/r/reddit.com/comments/duf7q/random_reddit_protip_you_can_add_yourself_as_a/
private boolean isFriend;

// Indicates whether the user is over 18
Expand Down Expand Up @@ -183,4 +184,27 @@ public Boolean getOver18() {
public void setOver18(Boolean over18) {
this.over18 = over18;
}

public String toString() {
StringBuilder result = new StringBuilder();
String newLine = System.lineSeparator();

result.append("id: ").append(id).append(newLine)
.append("name: ").append(name).append(newLine)
.append("modhash: ").append(modhash).append(newLine)
.append("commentKarma: ").append(commentKarma).append(newLine)
.append("linkKarma: ").append(id).append(newLine)
.append("isModerator: ").append(isMod).append(newLine)
.append("hasModMail: ").append(hasModMail).append(newLine)
.append("hasMail: ").append(hasMail).append(newLine)
.append("hasVerifiedEmail: ").append(hasVerifiedEmail).append(newLine)
.append("isGold: ").append(isGold).append(newLine)
.append("Created: ").append(created).append(newLine)
.append("CreatedUTC: ").append(createdUTC).append(newLine)
.append("isFriend: ").append(isFriend).append(newLine)
.append("over18: ").append(over18).append(newLine);

return result.toString();

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class ApiEndpointUtils {

public static final String USER_INFO = REDDIT_BASE_API_ENDPOINT + "/me.json";

public static final String USER_UPDATE = REDDIT_BASE_API_ENDPOINT + "/update";
public static final String USER_UPDATE = REDDIT_BASE_API_ENDPOINT + "/update";

/* Subreddits specific constants */

Expand Down

0 comments on commit b922c56

Please sign in to comment.