/*******************************************************************************
* Copyright (c) 2012-2015 Codenvy, S.A.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.api.user.server.dao;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* @author Eugene Voevodin
*/
public class User {
private String id;
private String email;
private String password;
private List<String> aliases;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public User withId(String id) {
this.id = id;
return this;
}
public List<String> getAliases() {
if (aliases == null) {
aliases = new ArrayList<>();
}
return aliases;
}
public void setAliases(List<String> aliases) {
this.aliases = aliases;
}
public User withAliases(List<String> aliases) {
this.aliases = aliases;
return this;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public User withEmail(String email) {
this.email = email;
return this;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public User withPassword(String password) {
this.password = password;
return this;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof User)) {
return false;
}
final User other = (User)obj;
return Objects.equals(id, other.id) &&
Objects.equals(email, other.email) &&
Objects.equals(password, other.password) &&
Objects.equals(getAliases(), other.getAliases());
}
@Override
public int hashCode() {
int hash = 7;
hash = 31 * hash + Objects.hashCode(id);
hash = 31 * hash + Objects.hashCode(email);
hash = 31 * hash + Objects.hashCode(password);
hash = 31 * hash + Objects.hashCode(getAliases());
return hash;
}
}