package fr.ekito.example.domain;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.joda.deser.LocalDateDeserializer;
import fr.ekito.example.domain.util.CustomLocalDateSerializer;
import org.joda.time.LocalDate;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
import java.io.Serializable;
/**
* A Author.
*/
@Document(collection = "T_AUTHOR")
public class Author extends MultitenantEntity implements Serializable {
@Id
private String id;
@Field("name")
private String name;
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonSerialize(using = CustomLocalDateSerializer.class)
@Field("birth_date")
private LocalDate birthDate;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public LocalDate getBirthDate() {
return birthDate;
}
public void setBirthDate(LocalDate birthDate) {
this.birthDate = birthDate;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Author author = (Author) o;
if (id != null ? !id.equals(author.id) : author.id != null) return false;
return true;
}
@Override
public int hashCode() {
return id != null ? id.hashCode() : 0;
}
@Override
public String toString() {
return "Author{" +
"id=" + id +
", name='" + name + "'" +
", birthDate='" + birthDate + "'" +
'}';
}
}