Subversion Repositories SmartDukaan

Rev

Rev 21600 | Rev 23780 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.spice.profitmandi.common.model;

import java.util.List;

public class UserInfo {
        private final String email;
        private final int userId;
        private final List<String> roleNames;
        public UserInfo(int userId, List<String> roleNames, String email){
                this.userId = userId;
                this.roleNames = roleNames;
                this.email = email;
        }
        public int getUserId() {
                return userId;
        }
        public void addRoleName(String roleName){
                roleNames.add(roleName);
        }
        public List<String> getRoleNames() {
                return roleNames;
        }
        public String getEmail() {
                return email;
        }
        
        
        @Override
        public int hashCode() {
                final int prime = 31;
                int result = 1;
                result = prime * result + ((email == null) ? 0 : email.hashCode());
                result = prime * result + ((roleNames == null) ? 0 : roleNames.hashCode());
                result = prime * result + userId;
                return result;
        }
        @Override
        public boolean equals(Object obj) {
                if (this == obj)
                        return true;
                if (obj == null)
                        return false;
                if (getClass() != obj.getClass())
                        return false;
                UserInfo other = (UserInfo) obj;
                if (email == null) {
                        if (other.email != null)
                                return false;
                } else if (!email.equals(other.email))
                        return false;
                if (roleNames == null) {
                        if (other.roleNames != null)
                                return false;
                } else if (!roleNames.equals(other.roleNames))
                        return false;
                if (userId != other.userId)
                        return false;
                return true;
        }
        @Override
        public String toString() {
                return "UserInfo [email=" + email + ", userId=" + userId + ", roleNames=" + roleNames + "]";
        }
        
        
        
}