From 91a07facc6e4417810cebbfe017a4ac167ac13b1 Mon Sep 17 00:00:00 2001 From: Alexander Alexeev Date: Sat, 26 Nov 2016 04:34:57 +0700 Subject: some improvenments on user service --- juick-core/src/main/java/com/juick/User.java | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'juick-core') 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; + } } -- cgit v1.2.3