/** * */ package org.springframework.data.aerospike.core; import java.util.ArrayList; import java.util.Date; import java.util.Map; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.ToString; import org.springframework.data.aerospike.mapping.Field; import org.springframework.data.annotation.Id; /** * * * @author Peter Milne * @author Jean Mercier * */ @AllArgsConstructor @ToString @Builder public class Person { private @Id String id; private String firstName; private int age; private Map<String, String> map; private Person friend; private boolean active = true; private Date dateOfBirth; private ArrayList<String> list; @Field("email") private String emailAddress; public Person() { super(); } public Person(String id, String firstname) { this.id = id; this.firstName = firstname; } public Person(String id, String firstname, int age) { this.id = id; this.firstName = firstname; this.age = age; } public String getId() { return id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public Person getFriend() { return friend; } public void setFriend(Person friend) { this.friend = friend; } public Date getDateOfBirth() { return dateOfBirth; } public void setDateOfBirth(Date dateOfBirth) { this.dateOfBirth = dateOfBirth; } public void setActive(boolean active) { this.active = active; } /** * @return the active */ public boolean isActive() { return active; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Person other = (Person) obj; if (active != other.active) return false; if (age != other.age) return false; if (dateOfBirth == null) { if (other.dateOfBirth != null) return false; } else if (!dateOfBirth.equals(other.dateOfBirth)) return false; if (emailAddress == null) { if (other.emailAddress != null) return false; } else if (!emailAddress.equals(other.emailAddress)) return false; if (firstName == null) { if (other.firstName != null) return false; } else if (!firstName.equals(other.firstName)) return false; if (friend == null) { if (other.friend != null) return false; } else if (!friend.equals(other.friend)) return false; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if (list == null) { if (other.list != null) return false; } else if (!list.equals(other.list)) return false; if (map == null) { if (other.map != null) return false; } else if (!map.equals(other.map)) return false; return true; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (active ? 1231 : 1237); result = prime * result + age; result = prime * result + ((dateOfBirth == null) ? 0 : dateOfBirth.hashCode()); result = prime * result + ((emailAddress == null) ? 0 : emailAddress.hashCode()); result = prime * result + ((firstName == null) ? 0 : firstName.hashCode()); result = prime * result + ((friend == null) ? 0 : friend.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((list == null) ? 0 : list.hashCode()); result = prime * result + ((map == null) ? 0 : map.hashCode()); return result; } public Map<String, String> getMap() { return map; } public void setMap(Map<String, String> map) { this.map = map; } public ArrayList<String> getList() { return list; } public void setList(ArrayList<String> list) { this.list = list; } public String getEmailAddress() { return emailAddress; } public void setEmailAddress(String emailAddress) { this.emailAddress = emailAddress; } }