br.com.jhonsapp.bootstrap.object.domain.generic.AbstractDomainObject Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bootstrap-object Show documentation
Show all versions of bootstrap-object Show documentation
A complete architecture for creating and managing users.
package br.com.jhonsapp.bootstrap.object.domain.generic;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import br.com.jhonsapp.util.date.DateGenerator;
/**
* {@link AbstractDomainObject} is an abstract implementation of
* {@link DomainObject}.
*
* @see DomainObject
*
* @author Jhonathan Camacho
* @author Jhonys Camacho
*
*/
@MappedSuperclass
public abstract class AbstractDomainObject implements DomainObject {
/**
* Generated serial version id created at 21 April 2017.
*/
private static final long serialVersionUID = -2863804897094916874L;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "created_at")
private Date createdAt;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "updated_at")
private Date updatedAt;
public AbstractDomainObject() {
}
@PrePersist
public void createAt() {
this.createdAt = DateGenerator.toInstant();
}
@PreUpdate
public void updatedAt() {
this.updatedAt = DateGenerator.toInstant();
}
public abstract long getId();
public Date getCreatedAt() {
return this.createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return this.updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
}