31 lines
771 B
Java
31 lines
771 B
Java
package com.webproglabs.lab1.dto;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
import com.webproglabs.lab1.models.Comment;
|
|
|
|
import javax.validation.constraints.NotBlank;
|
|
|
|
public class CommentDto {
|
|
private Long id;
|
|
@NotBlank
|
|
private String text;
|
|
@NotBlank
|
|
private String authorLogin;
|
|
|
|
public CommentDto(Comment comment) {
|
|
this.id = comment.getId();
|
|
this.text = comment.getText();
|
|
this.authorLogin = comment.getOwner().getLogin();
|
|
}
|
|
|
|
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
|
public long getId() {
|
|
return id;
|
|
}
|
|
public String getText() {return text;}
|
|
public void setText(String text) {
|
|
this.text = text;
|
|
}
|
|
public String getAuthor() {return authorLogin;}
|
|
}
|