Skip to content

Commit

Permalink
feat: make dates optional
Browse files Browse the repository at this point in the history
  • Loading branch information
martinalbert committed Oct 28, 2024
1 parent 065033e commit 00123f2
Showing 1 changed file with 40 additions and 12 deletions.
52 changes: 40 additions & 12 deletions src/main/java/com/buttercms/model/Page.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@
import java.util.Date;
import java.util.Objects;
import java.util.StringJoiner;
import java.util.Optional;

@JsonIgnoreProperties(ignoreUnknown = true)
public class Page<T> {
private String slug;
private String pageType;
private String name;
private T fields;
private Status status;
private Date scheduled;
private Date updated;
private Optional<String> pageType;
private Optional<Date> published;
private Optional<Date> scheduled;

public String getSlug() {
return slug;
Expand All @@ -23,14 +27,6 @@ public void setSlug(String slug) {
this.slug = slug;
}

public String getPageType() {
return pageType;
}

public void setPageType(String pageType) {
this.pageType = pageType;
}

public T getFields() {
return fields;
}
Expand All @@ -47,12 +43,44 @@ public void setStatus(Status status) {
this.status = status;
}

public Date getScheduled() {
public Optional<Date> getScheduled() {
return scheduled;
}

public void setScheduled(Date scheduled) {
this.scheduled = scheduled;
this.scheduled = Optional.ofNullable(scheduled);
}

public Date getUpdated() {
return updated;
}

public void setUpdated(Date updated) {
this.updated = updated;
}

public Optional<Date> getPublished() {
return published;
}

public void setPublished(Date published) {
this.published = Optional.ofNullable(published);
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public Optional<String> getPageType() {
return pageType;
}

public void setPageType(String pageType) {
this.pageType = Optional.ofNullable(pageType);
}

@Override
Expand Down

0 comments on commit 00123f2

Please sign in to comment.