it.vige.school.model.PresenceId Maven / Gradle / Ivy
package it.vige.school.model;
import static javax.persistence.TemporalType.DATE;
import java.io.Serializable;
import java.util.Calendar;
import javax.persistence.Embeddable;
import javax.persistence.Temporal;
@Embeddable
public class PresenceId implements Serializable {
private static final long serialVersionUID = -3002711450547460105L;
@Temporal(DATE)
private Calendar day;
private String user;
public Calendar getDay() {
return day;
}
public void setDay(Calendar day) {
this.day = day;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((day == null) ? 0 : day.hashCode());
result = prime * result + ((user == null) ? 0 : user.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;
PresenceId other = (PresenceId) obj;
if (day == null) {
if (other.day != null)
return false;
} else if (!day.equals(other.day))
return false;
if (user == null) {
if (other.user != null)
return false;
} else if (!user.equals(other.user))
return false;
return true;
}
}