diff options
author | 2016-11-26 04:34:57 +0700 | |
---|---|---|
committer | 2016-11-26 04:34:57 +0700 | |
commit | 91a07facc6e4417810cebbfe017a4ac167ac13b1 (patch) | |
tree | 741b055031d63ea5ac0d4b33bc399d97e456b197 /juick-core/src | |
parent | b0d89589ae42ba9c099ef934c39bebc6b0a75f7f (diff) |
some improvenments on user service
Diffstat (limited to 'juick-core/src')
-rw-r--r-- | juick-core/src/main/java/com/juick/User.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/juick-core/src/main/java/com/juick/User.java b/juick-core/src/main/java/com/juick/User.java index f71ec781..03805a65 100644 --- a/juick-core/src/main/java/com/juick/User.java +++ b/juick-core/src/main/java/com/juick/User.java @@ -19,6 +19,8 @@ package com.juick; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; import javax.xml.bind.annotation.*; @@ -36,6 +38,7 @@ public class User { private int messagesCount; private String authHash; private boolean banned; + private String credentials; public User() { } @@ -57,6 +60,25 @@ public class User { (obj instanceof User && ((User) obj).getUid() == this.getUid()); } + @Override + public int hashCode() { + return new HashCodeBuilder() + .append(getUid()) + .toHashCode(); + } + + @Override + public String toString() { + return new ToStringBuilder(this) + .append("uid", uid) + .append("name", name) + .append("fullName", fullName) + .append("jid", jid) + .append("messagesCount", messagesCount) + .append("banned", banned) + .toString(); + } + @JsonProperty("uid") @XmlAttribute(name = "uid") public int getUid() { @@ -132,4 +154,14 @@ public class User { public void setAvatar(Object avatar) { this.avatar = avatar; } + + @XmlTransient + @JsonIgnore + public String getCredentials() { + return credentials; + } + + public void setCredentials(String credentials) { + this.credentials = credentials; + } } |