forked from osopromadze/Spring-Boot-Blog-REST-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPostRequest.java
More file actions
41 lines (30 loc) · 748 Bytes
/
PostRequest.java
File metadata and controls
41 lines (30 loc) · 748 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package com.sopromadze.blogapi.payload;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@Data
public class PostRequest {
@NotBlank
@Size(min = 10)
private String title;
@NotBlank
@Size(min = 50)
private String body;
@NotNull
private Long categoryId;
private List<String> tags;
public List<String> getTags() {
return tags == null ? Collections.emptyList() : new ArrayList<>(tags);
}
public void setTags(List<String> tags) {
if (tags == null) {
this.tags = null;
} else {
this.tags = Collections.unmodifiableList(tags);
}
}
}