/*
* @(#)User.java 2012-9-4 下午23:59:06
*
* Copyright (c) 2011-2012 Makersoft.org all rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
*
*/
package org.makersoft.shards.domain.shard0;
import org.makersoft.shards.domain.AbstractShardEntity;
/**
* User domain for test.
*/
public class User extends AbstractShardEntity {
private static final long serialVersionUID = -2426776467504642746L;
public static final int SEX_MALE = 0;
public static final int SEX_FEMALE = 1;
private String username;
private String password;
private int age;
private int gender;
public User() {
}
/**
* 有参构造,方便测试用例初始化
*/
public User(String username, String password, int gender) {
this.username = username;
this.password = password;
this.gender = gender;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public int getGender() {
return gender;
}
public void setGender(int gender) {
this.gender = gender;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + age;
result = prime * result + gender;
result = prime * result
+ ((password == null) ? 0 : password.hashCode());
result = prime * result
+ ((username == null) ? 0 : username.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
User other = (User) obj;
if (age != other.age)
return false;
if (gender != other.gender)
return false;
if (password == null) {
if (other.password != null)
return false;
} else if (!password.equals(other.password))
return false;
if (username == null) {
if (other.username != null)
return false;
} else if (!username.equals(other.username))
return false;
return true;
}
}