Skip to content

Commit 00123f2

Browse files
committed
feat: make dates optional
1 parent 065033e commit 00123f2

1 file changed

Lines changed: 40 additions & 12 deletions

File tree

src/main/java/com/buttercms/model/Page.java

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@
66
import java.util.Date;
77
import java.util.Objects;
88
import java.util.StringJoiner;
9+
import java.util.Optional;
910

1011
@JsonIgnoreProperties(ignoreUnknown = true)
1112
public class Page<T> {
1213
private String slug;
13-
private String pageType;
14+
private String name;
1415
private T fields;
1516
private Status status;
16-
private Date scheduled;
17+
private Date updated;
18+
private Optional<String> pageType;
19+
private Optional<Date> published;
20+
private Optional<Date> scheduled;
1721

1822
public String getSlug() {
1923
return slug;
@@ -23,14 +27,6 @@ public void setSlug(String slug) {
2327
this.slug = slug;
2428
}
2529

26-
public String getPageType() {
27-
return pageType;
28-
}
29-
30-
public void setPageType(String pageType) {
31-
this.pageType = pageType;
32-
}
33-
3430
public T getFields() {
3531
return fields;
3632
}
@@ -47,12 +43,44 @@ public void setStatus(Status status) {
4743
this.status = status;
4844
}
4945

50-
public Date getScheduled() {
46+
public Optional<Date> getScheduled() {
5147
return scheduled;
5248
}
5349

5450
public void setScheduled(Date scheduled) {
55-
this.scheduled = scheduled;
51+
this.scheduled = Optional.ofNullable(scheduled);
52+
}
53+
54+
public Date getUpdated() {
55+
return updated;
56+
}
57+
58+
public void setUpdated(Date updated) {
59+
this.updated = updated;
60+
}
61+
62+
public Optional<Date> getPublished() {
63+
return published;
64+
}
65+
66+
public void setPublished(Date published) {
67+
this.published = Optional.ofNullable(published);
68+
}
69+
70+
public String getName() {
71+
return name;
72+
}
73+
74+
public void setName(String name) {
75+
this.name = name;
76+
}
77+
78+
public Optional<String> getPageType() {
79+
return pageType;
80+
}
81+
82+
public void setPageType(String pageType) {
83+
this.pageType = Optional.ofNullable(pageType);
5684
}
5785

5886
@Override

0 commit comments

Comments
 (0)