package jsonfeed4j;

import java.time.ZonedDateTime;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import jsonfeed4j.validation.ValidItemContent;

@ValidItemContent
public class Item {

  @NotNull @Size(min = 1)
  private String id;
  private String contentText;
  private String contentHtml;
  private Map<String, Object> extensions = Collections.emptyMap();
  private String url;
  private String externalUrl;
  private String title;
  private String summary;
  private String image;
  private String bannerImage;
  private ZonedDateTime datePublished;
  private ZonedDateTime dateModified;
  @Valid
  private Author author;
  private List<String> tags = Collections.emptyList();
  private List<Attachment> attachments = Collections.emptyList();
  
  public String getId() {
    return id;
  }
  
  public String getContentText() {
    return contentText;
  }

  public Extensions getExtensions() {
    return new Extensions(extensions);
  }
  
  public String getContentHtml() {
    return contentHtml;
  }
  
  public Optional<String> getUrl() {
    return Optional.ofNullable(url);    
  }
  
  public Optional<String> getExternalUrl() {
    return Optional.ofNullable(externalUrl);    
  }
  
  public Optional<String> getTitle() {
    return Optional.ofNullable(title);    
  }
  
  public Optional<String> getSummary() {
    return Optional.ofNullable(summary);    
  }
  
  public Optional<String> getImage() {
    return Optional.ofNullable(image);    
  }
  
  public Optional<String> getBannerImage() {
    return Optional.ofNullable(bannerImage);    
  }
  
  public Optional<ZonedDateTime> getDatePublished() {
    return Optional.ofNullable(datePublished);    
  }
  
  public Optional<ZonedDateTime> getDateModified() {
    return Optional.ofNullable(dateModified);    
  }

  public List<String> getTags() {
    return tags;
  }

  public Optional<Author> getAuthor() {
    return Optional.ofNullable(author);
  }

  public List<Attachment> getAttachments() {
    return attachments ;
  }
}

@@ -180,24 +180,25 @@
 .Valid;%0A
+%0A
 import j
 avax.val
@@ -181,36 +181,41 @@
 Valid;%0A%0Aimport j
-avax
+sonfeed4j
 .validation.cons
@@ -214,71 +214,23 @@
 ion.
-constraints.NotNull;%0Aimport javax.validation.cons
+RequiredS
 tr
-a
 in
-ts.Size;%0A
+g;
 %0Aimp
@@ -320,30 +320,22 @@
 %0A  @
-NotNull @Size(min = 1)
+RequiredString
 %0A  p

Use @RequiredString for Item#id