package ru.ulstu.grant.model; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import org.hibernate.validator.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.util.Date; public class ProjectDto { private final Integer id; @NotEmpty private final String title; @JsonCreator public ProjectDto(@JsonProperty("id") Integer id, @JsonProperty("title") String title){ this.id = id; this.title = title; } public ProjectDto(Project project) { this.id = project.getId(); this.title = project.getTitle(); } public Integer getId() { return id; } public String getTitle() { return title; } }